odoo18/addons_extensions/weekly_timesheets/views/week_timesheet.xml

219 lines
6.8 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_week_timesheet_list" model="ir.ui.view">
<field name="name">week.timesheet.list</field>
<field name="model">week.timesheet</field>
<field name="arch" type="xml">
<list string="Week Master">
<field name="year"/>
</list>
</field>
</record>
<record id="view_week_timesheet_form" model="ir.ui.view">
<field name="name">week.timesheet.form</field>
<field name="model">week.timesheet</field>
<field name="arch" type="xml">
<form string="Week Master">
<sheet>
<group>
<group col="4">
<field name="year"/>
<button name="action_generate_weeks"
string="Generate Weeks"
type="object"
class="btn-primary"/>
</group>
</group>
<field name="week_line_ids">
<list create="0"
edit="0"
delete="0">
<field name="week_name"/>
<field name="date_from"/>
<field name="date_to"/>
</list>
</field>
</sheet>
</form>
</field>
</record>
<record id="action_week_master" model="ir.actions.act_window">
<field name="res_model">week.timesheet</field>
<field name="view_mode">list,form</field>
<field name="view_ids"
eval="[(5, 0, 0),
(0, 0, {'view_mode': 'list', 'view_id': ref('view_week_timesheet_list')}),
(0, 0, {'view_mode': 'form', 'view_id': ref('view_week_timesheet_form')})]"/>
</record>
<record id="view_account_analytic_line_tree_inherit"
model="ir.ui.view">
<field name="name">
account.analytic.line.tree.inherit
</field>
<field name="model">account.analytic.line</field>
<field name="inherit_id"
ref="hr_timesheet.timesheet_view_tree_user"/>
<field name="arch" type="xml">
<xpath expr="//list" position="inside">
<field name="approval_state" optional="hide"/>
<button name="action_pm_approve"
string="Approve"
type="object"
class="btn-success"
invisible="approval_state == 'approved' or not project_id "/>
<button name="action_pm_reject"
string="Reject"
type="object"
class="btn-danger"
invisible="approval_state == 'rejected' or not project_id "/>
</xpath>
</field>
</record>
<record id="view_account_analytic_line_search_pm"
model="ir.ui.view">
<field name="name">
account.analytic.line.search.pm
</field>
<field name="model">account.analytic.line</field>
<field name="arch" type="xml">
<search string="Search Timesheets">
<!-- Filters -->
<filter name="to_approve"
string="To Approve"
domain="[('approval_state','=','draft')]"
/>
<filter name="approved"
string="Approved"
domain="[('approval_state','=','approved')]"/>
<filter name="rejected"
string="Rejected"
domain="[('approval_state','=','rejected')]"/>
<!-- Group By -->
<group expand="0" string="Group By">
<filter name="group_by_approval"
string="Approval Status"
context="{'group_by':'approval_state'}"/>
<filter name="group_by_employee"
string="Employee"
context="{'group_by':'employee_id'}"/>
<filter name="group_by_project"
string="Project"
context="{'group_by':'project_id'}"/>
</group>
</search>
</field>
</record>
<record id="server_action_pm_approve"
model="ir.actions.server">
<field name="name">Approve</field>
<field name="model_id"
ref="analytic.model_account_analytic_line"/>
<field name="binding_model_id"
ref="analytic.model_account_analytic_line"/>
<field name="binding_view_types">list</field>
<field name="state">code</field>
<field name="code">
action = records.action_pm_approve()
</field>
</record>
<record id="server_action_pm_reject"
model="ir.actions.server">
<field name="name">Reject</field>
<field name="model_id"
ref="analytic.model_account_analytic_line"/>
<field name="binding_model_id"
ref="analytic.model_account_analytic_line"/>
<field name="binding_view_types">list</field>
<field name="state">code</field>
<field name="code">
action = records.action_pm_reject()
</field>
</record>
<record id="action_weekly_timesheet_approval"
model="ir.actions.act_window">
<field name="name">Weekly Timesheet Approval</field>
<field name="res_model">account.analytic.line</field>
<field name="view_mode">list</field>
<field name="view_id"
ref="view_account_analytic_line_tree_inherit"/>
<field name="domain">
[
('weekly_submitted','=',True),
('project_id.active','=',True),
('pm_approval_required','=',True)
]
</field>
<field name="context">
{'search_default_to_approve': 1}
</field>
</record>
<menuitem
id="menu_week_master"
name="Week Master"
parent="hr_timesheet.hr_timesheet_menu_configuration"
action="action_week_master"
sequence="102"
/>
<menuitem
id="menu_weekly_timesheetss"
name="Weekly Timesheets"
parent="hr_timesheet.timesheet_menu_root"
action="action_weekly_period_timesheets"
sequence="99"
/>
<menuitem
id="menu_weekly_timesheet_approval"
name="Weekly Timesheet Approval"
parent="hr_timesheet.timesheet_menu_root"
action="action_weekly_timesheet_approval"
sequence="200"/>
</odoo>