[REV] hr_timesheet: refactor search view of timesheet

This reverts commit 4dcf11a71d.

The reason is that it broke the inheritance with `analytic`, and thus with `account`.
This in turn made it impossible to harmonize the search view between modules.

Part-of: odoo/odoo#138542
This commit is contained in:
John Laterre (jol)
2023-10-20 14:59:16 +00:00
parent da251b757d
commit f5b2dea457
4 changed files with 59 additions and 18 deletions
@@ -81,11 +81,28 @@
<record id="hr_timesheet_report_search" model="ir.ui.view">
<field name="name">timesheets.analysis.report.search</field>
<field name="model">timesheets.analysis.report</field>
<field name="inherit_id" ref="hr_timesheet.hr_timesheet_line_search_base"/>
<field name="mode">primary</field>
<field name="arch" type="xml">
<search position="attributes">
<attribute name="string">Timesheet Report</attribute>
<search string="Timesheet">
<field name="date"/>
<field name="employee_id"/>
<field name="project_id"/>
<field name="ancestor_task_id" groups="project.group_subtask_project"/>
<field name="task_id"/>
<field name="name"/>
<field name="department_id"/>
<field name="manager_id"/>
<filter name="mine" string="My Timesheets" domain="[('user_id', '=', uid)]"/>
<separator/>
<filter name="month" string="Date" date="date"/>
<group expand="0" string="Group By">
<filter string="Project" name="groupby_project" domain="[]" context="{'group_by': 'project_id'}"/>
<filter string="Ancestor Task" name="groupby_parent_task" domain="[]" context="{'group_by': 'ancestor_task_id'}" groups="project.group_subtask_project"/>
<filter string="Task" name="groupby_task" domain="[]" context="{'group_by': 'task_id'}"/>
<filter string="Date" name="groupby_date" domain="[]" context="{'group_by': 'date'}" help="Timesheet by Date"/>
<filter string="Department" name="groupby_department" domain="[]" context="{'group_by': 'department_id'}"/>
<filter string="Manager" name="groupby_manager" domain="[]" context="{'group_by': 'manager_id'}"/>
<filter string="Employee" name="groupby_employee" domain="[]" context="{'group_by': 'employee_id'}"/>
</group>
</search>
</field>
</record>
@@ -166,8 +166,7 @@
</field>
</record>
<!-- Base search view, contains the fields and filters common to timesheet and timesheet report -->
<record id="hr_timesheet_line_search_base" model="ir.ui.view">
<record id="hr_timesheet_line_search" model="ir.ui.view">
<field name="name">account.analytic.line.search</field>
<field name="model">account.analytic.line</field>
<field name="arch" type="xml">
@@ -199,7 +198,7 @@
<record id="hr_timesheet_line_my_timesheet_search" model="ir.ui.view">
<field name="name">view.search.my.timesheet.menu</field>
<field name="model">account.analytic.line</field>
<field name="inherit_id" ref="hr_timesheet_line_search_base"/>
<field name="inherit_id" ref="hr_timesheet_line_search"/>
<field name="mode">primary</field>
<field name="arch" type="xml">
<field name="employee_id" position="replace"/>
@@ -212,16 +211,6 @@
</field>
</record>
<record id="hr_timesheet_line_search" model="ir.ui.view">
<field name="name">view.search.my.timesheet.menu</field>
<field name="model">account.analytic.line</field>
<field name="inherit_id" ref="hr_timesheet_line_search_base"/>
<field name="mode">primary</field>
<field name="arch" type="xml">
<search position="inside"/>
</field>
</record>
<record id="view_kanban_account_analytic_line" model="ir.ui.view">
<field name="name">account.analytic.line.kanban</field>
<field name="model">account.analytic.line</field>
@@ -50,6 +50,41 @@
</field>
</record>
<record id="hr_timesheet_report_search_sale_timesheet" model="ir.ui.view">
<field name="name">timesheets.analysis.report.search</field>
<field name="model">timesheets.analysis.report</field>
<field name="inherit_id" ref="hr_timesheet.hr_timesheet_report_search"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='task_id']" position="after">
<field name="order_id" string="Sales Order" groups="sales_team.group_sale_salesman"/>
<field name="so_line" groups="sales_team.group_sale_salesman"/>
</xpath>
<xpath expr="//filter[@name='month']" position="before">
<filter name="billable_fixed" string="Billed at a Fixed Price" domain="[('timesheet_invoice_type', '=', 'billable_fixed')]"
groups="sales_team.group_sale_salesman"/>
<filter name="billable_time" string="Billed on Timesheets" domain="[('timesheet_invoice_type', '=', 'billable_time')]"
groups="sales_team.group_sale_salesman"/>
<filter name="billable_milestones" string="Billed on Milestones" domain="[('timesheet_invoice_type', '=', 'billable_milestones')]"
groups="sales_team.group_sale_salesman"/>
<filter name="billable_manual" string="Billed Manually" domain="[('timesheet_invoice_type', '=', 'billable_manual')]"
groups="sales_team.group_sale_salesman"/>
<filter name="non_billable" string="Non-Billable" domain="[('timesheet_invoice_type', '=', 'non_billable')]"
groups="sales_team.group_sale_salesman"/>
<separator/>
</xpath>
<xpath expr="//filter[@name='groupby_employee']" position="after">
<filter string="Sales Order" name="groupby_sale_order" domain="[]"
context="{'group_by': 'order_id'}" groups="sales_team.group_sale_salesman"/>
<filter string="Sales Order Item" name="groupby_sale_order_item" domain="[]"
context="{'group_by': 'so_line'}" groups="sales_team.group_sale_salesman"/>
<filter string="Invoice" name="groupby_invoice" domain="[]"
context="{'group_by': 'timesheet_invoice_id'}" groups="sales_team.group_sale_salesman"/>
<filter string="Billable Type" name="groupby_timesheet_invoice_type" domain="[]"
context="{'group_by': 'timesheet_invoice_type'}" groups="sales_team.group_sale_salesman"/>
</xpath>
</field>
</record>
<record id="timesheet_action_billing_report" model="ir.actions.act_window">
<field name="name">Timesheets by Billing Type</field>
<field name="res_model">timesheets.analysis.report</field>
@@ -4,7 +4,7 @@
<record id="timesheet_view_search" model="ir.ui.view">
<field name="name">account.analytic.line.search</field>
<field name="model">account.analytic.line</field>
<field name="inherit_id" ref="hr_timesheet.hr_timesheet_line_search_base"/>
<field name="inherit_id" ref="hr_timesheet.hr_timesheet_line_search"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='task_id']" position="after">
<field name="order_id" string="Sales Order" filter_domain="['|', ('so_line', 'ilike', self), ('order_id', 'ilike', self)]"/>