[REF] hr_timesheet: refactor search view of timesheet

This commit uses timesheet search view for timesheet report
search view so that way we don't have to repeat everything
we do with timesheet search view.

task-2983879

Part-of: odoo/odoo#106047
This commit is contained in:
Kartik Chavda
2023-01-25 17:49:50 +01:00
committed by Xavier BOL (xbo)
parent 3bcdd1e588
commit 4dcf11a71d
4 changed files with 18 additions and 59 deletions
@@ -81,28 +81,11 @@
<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 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 position="attributes">
<attribute name="string">Timesheet Report</attribute>
</search>
</field>
</record>
@@ -169,7 +169,8 @@
</field>
</record>
<record id="hr_timesheet_line_search" model="ir.ui.view">
<!-- 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">
<field name="name">account.analytic.line.search</field>
<field name="model">account.analytic.line</field>
<field name="arch" type="xml">
@@ -201,7 +202,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"/>
<field name="inherit_id" ref="hr_timesheet_line_search_base"/>
<field name="mode">primary</field>
<field name="arch" type="xml">
<field name="employee_id" position="replace"/>
@@ -214,6 +215,16 @@
</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,41 +50,6 @@
</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"/>
<field name="inherit_id" ref="hr_timesheet.hr_timesheet_line_search_base"/>
<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"/>