[IMP] hr(_timesheet)_attendance: improvements for the ui
PURPOSE Generic improvements for services. SPECIFICATION - For all reporting menus: removed the group by in the search view, and kept grouping the grid, pivot and graph views by the corresponding field. - For timesheet/attendance, switched the pivot and graph views from their places. - Renamed 'billable type' into 'billing type'. task-2766164 closes odoo/odoo#85726 Related: odoo/enterprise#24940 Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
This commit is contained in:
committed by
Barad Mahendra
parent
bbc2128ba1
commit
1e4ddef514
@@ -5,7 +5,7 @@
|
||||
<field name="name">Timesheets by Employee</field>
|
||||
<field name="res_model">account.analytic.line</field>
|
||||
<field name="domain">[('project_id', '!=', False)]</field>
|
||||
<field name="context">{'search_default_groupby_employee':1, 'grid_range': 'week'}</field>
|
||||
<field name="context">{'grid_range': 'week'}</field>
|
||||
<field name="search_view_id" ref="hr_timesheet_line_search"/>
|
||||
<field name="help" type="html">
|
||||
<p class="o_view_nocontent_empty_folder">
|
||||
@@ -27,7 +27,7 @@
|
||||
<record id="timesheet_action_view_report_by_employee_graph" model="ir.actions.act_window.view">
|
||||
<field name="sequence" eval="6"/>
|
||||
<field name="view_mode">graph</field>
|
||||
<field name="view_id" ref="hr_timesheet.view_hr_timesheet_line_graph"/>
|
||||
<field name="view_id" ref="hr_timesheet.view_hr_timesheet_line_graph_all"/>
|
||||
<field name="act_window_id" ref="act_hr_timesheet_report"/>
|
||||
</record>
|
||||
|
||||
@@ -52,11 +52,33 @@
|
||||
<field name="act_window_id" ref="act_hr_timesheet_report"/>
|
||||
</record>
|
||||
|
||||
<record id="view_hr_timesheet_line_pivot_groupby_project" model="ir.ui.view">
|
||||
<field name="name">account.analytic.line.pivot</field>
|
||||
<field name="model">account.analytic.line</field>
|
||||
<field name="inherit_id" ref="hr_timesheet.view_hr_timesheet_line_pivot"/>
|
||||
<field name="mode">primary</field>
|
||||
<field name="arch" type="xml">
|
||||
<field name="employee_id" position="replace">
|
||||
<field name="project_id" type="row"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_hr_timesheet_line_graph_groupby_project" model="ir.ui.view">
|
||||
<field name="name">account.analytic.line.graph</field>
|
||||
<field name="model">account.analytic.line</field>
|
||||
<field name="inherit_id" ref="hr_timesheet.view_hr_timesheet_line_graph"/>
|
||||
<field name="mode">primary</field>
|
||||
<field name="arch" type="xml">
|
||||
<field name="task_id" position="replace"/>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="timesheet_action_report_by_project" model="ir.actions.act_window">
|
||||
<field name="name">Timesheets by Project</field>
|
||||
<field name="res_model">account.analytic.line</field>
|
||||
<field name="domain">[('project_id', '!=', False)]</field>
|
||||
<field name="context">{'search_default_groupby_project': 1, 'grid_range': 'week'}</field>
|
||||
<field name="context">{'grid_range': 'week'}</field>
|
||||
<field name="search_view_id" ref="hr_timesheet_line_search"/>
|
||||
<field name="help" type="html">
|
||||
<p class="o_view_nocontent_empty_folder">
|
||||
@@ -71,14 +93,14 @@
|
||||
<record id="timesheet_action_view_report_by_project_pivot" model="ir.actions.act_window.view">
|
||||
<field name="sequence" eval="5"/>
|
||||
<field name="view_mode">pivot</field>
|
||||
<field name="view_id" ref="hr_timesheet.view_hr_timesheet_line_pivot"/>
|
||||
<field name="view_id" ref="hr_timesheet.view_hr_timesheet_line_pivot_groupby_project"/>
|
||||
<field name="act_window_id" ref="timesheet_action_report_by_project"/>
|
||||
</record>
|
||||
|
||||
<record id="timesheet_action_view_report_by_project_graph" model="ir.actions.act_window.view">
|
||||
<field name="sequence" eval="6"/>
|
||||
<field name="view_mode">graph</field>
|
||||
<field name="view_id" ref="hr_timesheet.view_hr_timesheet_line_graph"/>
|
||||
<field name="view_id" ref="hr_timesheet.view_hr_timesheet_line_graph_groupby_project"/>
|
||||
<field name="act_window_id" ref="timesheet_action_report_by_project"/>
|
||||
</record>
|
||||
|
||||
@@ -103,11 +125,35 @@
|
||||
<field name="act_window_id" ref="timesheet_action_report_by_project"/>
|
||||
</record>
|
||||
|
||||
<record id="view_hr_timesheet_line_pivot_groupby_task" model="ir.ui.view">
|
||||
<field name="name">account.analytic.line.pivot</field>
|
||||
<field name="model">account.analytic.line</field>
|
||||
<field name="inherit_id" ref="view_hr_timesheet_line_pivot_groupby_project"/>
|
||||
<field name="mode">primary</field>
|
||||
<field name="arch" type="xml">
|
||||
<field name="date" position="after">
|
||||
<field name="task_id" type="row"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_hr_timesheet_line_graph_groupby_task" model="ir.ui.view">
|
||||
<field name="name">account.analytic.line.graph</field>
|
||||
<field name="model">account.analytic.line</field>
|
||||
<field name="inherit_id" ref="hr_timesheet.view_hr_timesheet_line_graph"/>
|
||||
<field name="mode">primary</field>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='project_id']" position="after">
|
||||
<field name="task_id" position="move"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="timesheet_action_report_by_task" model="ir.actions.act_window">
|
||||
<field name="name">Timesheets by Task</field>
|
||||
<field name="res_model">account.analytic.line</field>
|
||||
<field name="domain">[('project_id', '!=', False)]</field>
|
||||
<field name="context">{'search_default_groupby_project':1,'search_default_groupby_task':1, 'grid_range': 'week'}</field>
|
||||
<field name="context">{'grid_range': 'week'}</field>
|
||||
<field name="search_view_id" ref="hr_timesheet_line_search"/>
|
||||
<field name="help" type="html">
|
||||
<p class="o_view_nocontent_empty_folder">
|
||||
@@ -122,14 +168,14 @@
|
||||
<record id="timesheet_action_view_report_by_task_pivot" model="ir.actions.act_window.view">
|
||||
<field name="sequence" eval="5"/>
|
||||
<field name="view_mode">pivot</field>
|
||||
<field name="view_id" ref="hr_timesheet.view_hr_timesheet_line_pivot"/>
|
||||
<field name="view_id" ref="hr_timesheet.view_hr_timesheet_line_pivot_groupby_task"/>
|
||||
<field name="act_window_id" ref="timesheet_action_report_by_task"/>
|
||||
</record>
|
||||
|
||||
<record id="timesheet_action_view_report_by_task_graph" model="ir.actions.act_window.view">
|
||||
<field name="sequence" eval="6"/>
|
||||
<field name="view_mode">graph</field>
|
||||
<field name="view_id" ref="hr_timesheet.view_hr_timesheet_line_graph"/>
|
||||
<field name="view_id" ref="hr_timesheet.view_hr_timesheet_line_graph_groupby_task"/>
|
||||
<field name="act_window_id" ref="timesheet_action_report_by_task"/>
|
||||
</record>
|
||||
|
||||
|
||||
@@ -53,3 +53,11 @@ class TimesheetAttendance(models.Model):
|
||||
ORDER BY t.date
|
||||
)
|
||||
""" % self._table)
|
||||
|
||||
@api.model
|
||||
def read_group(self, domain, fields, groupby, offset=0, limit=None, orderby=False, lazy=True):
|
||||
if not orderby and groupby:
|
||||
orderby_list = [groupby] if isinstance(groupby, str) else groupby
|
||||
orderby_list = [field.split(':')[0] for field in orderby_list]
|
||||
orderby = ','.join([f"{field} desc" if field == 'date' else field for field in orderby_list])
|
||||
return super().read_group(domain, fields, groupby, offset=offset, limit=limit, orderby=orderby, lazy=lazy)
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
<field name="model">hr.timesheet.attendance.report</field>
|
||||
<field name="arch" type="xml">
|
||||
<graph string="Timesheet Attendance" sample="1" disable_linking="1">
|
||||
<field name="date" interval="month"/>
|
||||
<field name="total_difference" type="measure" widget="timesheet_uom"/>
|
||||
</graph>
|
||||
</field>
|
||||
@@ -54,8 +55,8 @@
|
||||
<field name="name">Timesheet / Attendance</field>
|
||||
<field name="res_model">hr.timesheet.attendance.report</field>
|
||||
<field name="view_mode">graph,pivot</field>
|
||||
<field name="view_id" ref="view_hr_timesheet_attendance_report_pivot"/>
|
||||
<field name="context">{'search_default_group_by_month': True}</field>
|
||||
<field name="view_id" eval="False"/>
|
||||
<field name="context">{}</field>
|
||||
<field name="help" type="html">
|
||||
<p class="o_view_nocontent_empty_folder">
|
||||
No data yet!
|
||||
@@ -65,6 +66,13 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_hr_timesheet_attendance_report_pivot" model="ir.actions.act_window.view">
|
||||
<field name="sequence" eval="1"/>
|
||||
<field name="view_mode">pivot</field>
|
||||
<field name="view_id" ref="view_hr_timesheet_attendance_report_pivot"/>
|
||||
<field name="act_window_id" ref="action_hr_timesheet_attendance_report"/>
|
||||
</record>
|
||||
|
||||
<record id="action_hr_timesheet_attendance_report_graph" model="ir.actions.act_window.view">
|
||||
<field name="view_mode">graph</field>
|
||||
<field name="view_id" ref="hr_timesheet_attendance_report_view_graph"/>
|
||||
|
||||
@@ -23,7 +23,7 @@ class AccountAnalyticLine(models.Model):
|
||||
('timesheet_revenues', 'Timesheet Revenues'),
|
||||
('service_revenues', 'Service Revenues'),
|
||||
('other_revenues', 'Other Revenues'),
|
||||
('other_costs', 'Other Costs')], string="Billable Type",
|
||||
('other_costs', 'Other Costs')], string="Billing Type",
|
||||
compute='_compute_timesheet_invoice_type', compute_sudo=True, store=True, readonly=True)
|
||||
commercial_partner_id = fields.Many2one('res.partner', compute="_compute_commercial_partner")
|
||||
timesheet_invoice_id = fields.Many2one('account.move', string="Invoice", readonly=True, copy=False, help="Invoice created from the timesheet")
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<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'}"/>
|
||||
<filter string="Billable Type" name="groupby_timesheet_invoice_type" domain="[]" context="{'group_by': 'timesheet_invoice_type'}"/>
|
||||
<filter string="Billing Type" name="groupby_timesheet_invoice_type" domain="[]" context="{'group_by': 'timesheet_invoice_type'}"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
@@ -181,7 +181,6 @@
|
||||
<field name="view_mode">tree,form,pivot,graph,kanban</field>
|
||||
<field name="domain">[('project_id', '!=', False)]</field>
|
||||
<field name="context">{
|
||||
'search_default_groupby_timesheet_invoice_type': 1,
|
||||
'pivot_row_groupby': ['date:month'],
|
||||
}</field>
|
||||
<field name="help" type="html">
|
||||
@@ -195,6 +194,19 @@
|
||||
<field name="search_view_id" ref="hr_timesheet.hr_timesheet_line_search"/>
|
||||
</record>
|
||||
|
||||
<record id="view_hr_timesheet_line_graph_groupby_invoice_type" model="ir.ui.view">
|
||||
<field name="name">account.analytic.line.graph</field>
|
||||
<field name="model">account.analytic.line</field>
|
||||
<field name="inherit_id" ref="hr_timesheet.view_hr_timesheet_line_graph"/>
|
||||
<field name="mode">primary</field>
|
||||
<field name="arch" type="xml">
|
||||
<field name="task_id" position="replace"/>
|
||||
<field name="project_id" position="replace">
|
||||
<field name="timesheet_invoice_type"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="timesheet_action_view_report_by_billing_rate_form" model="ir.actions.act_window.view">
|
||||
<field name="sequence" eval="10"/>
|
||||
<field name="view_mode">form</field>
|
||||
@@ -219,7 +231,7 @@
|
||||
<record id="timesheet_action_view_report_by_billing_rate_graph" model="ir.actions.act_window.view">
|
||||
<field name="sequence" eval="6"/>
|
||||
<field name="view_mode">graph</field>
|
||||
<field name="view_id" ref="hr_timesheet.view_hr_timesheet_line_graph"/>
|
||||
<field name="view_id" ref="sale_timesheet.view_hr_timesheet_line_graph_groupby_invoice_type"/>
|
||||
<field name="act_window_id" ref="timesheet_action_billing_report"/>
|
||||
</record>
|
||||
|
||||
|
||||
@@ -913,9 +913,9 @@ tour.stepUtils.mobileModifier(tour.stepUtils.autoExpandMoreButtons('.o_control_p
|
||||
content: _t('Remove group by employee'),
|
||||
position: 'bottom',
|
||||
}, {
|
||||
trigger: '.dropdown-item.selected:contains(Billable Type)',
|
||||
trigger: '.dropdown-item.selected:contains(Billing Type)',
|
||||
extra_trigger: '.dropdown.show',
|
||||
content: _t('Remove group by billable type'),
|
||||
content: _t('Remove group by Billing type'),
|
||||
position: 'bottom',
|
||||
}, {
|
||||
mobile: true,
|
||||
|
||||
Reference in New Issue
Block a user