From 1e4ddef5141418e89dd0be49a509761bd8ab6f5d Mon Sep 17 00:00:00 2001 From: Ipsita Borisagar Date: Wed, 16 Feb 2022 13:20:38 +0000 Subject: [PATCH] [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) --- .../report/hr_timesheet_report_view.xml | 62 ++++++++++++++++--- .../report/hr_timesheet_attendance_report.py | 8 +++ .../hr_timesheet_attendance_report_view.xml | 12 +++- addons/sale_timesheet/models/account.py | 2 +- .../views/hr_timesheet_views.xml | 18 +++++- .../static/tests/tours/main_flow.js | 4 +- 6 files changed, 90 insertions(+), 16 deletions(-) diff --git a/addons/hr_timesheet/report/hr_timesheet_report_view.xml b/addons/hr_timesheet/report/hr_timesheet_report_view.xml index 8d567299ea4..8ac0985faec 100644 --- a/addons/hr_timesheet/report/hr_timesheet_report_view.xml +++ b/addons/hr_timesheet/report/hr_timesheet_report_view.xml @@ -5,7 +5,7 @@ Timesheets by Employee account.analytic.line [('project_id', '!=', False)] - {'search_default_groupby_employee':1, 'grid_range': 'week'} + {'grid_range': 'week'}

@@ -27,7 +27,7 @@ graph - + @@ -52,11 +52,33 @@ + + account.analytic.line.pivot + account.analytic.line + + primary + + + + + + + + + account.analytic.line.graph + account.analytic.line + + primary + + + + + Timesheets by Project account.analytic.line [('project_id', '!=', False)] - {'search_default_groupby_project': 1, 'grid_range': 'week'} + {'grid_range': 'week'}

@@ -71,14 +93,14 @@ pivot - + graph - + @@ -103,11 +125,35 @@ + + account.analytic.line.pivot + account.analytic.line + + primary + + + + + + + + + account.analytic.line.graph + account.analytic.line + + primary + + + + + + + Timesheets by Task account.analytic.line [('project_id', '!=', False)] - {'search_default_groupby_project':1,'search_default_groupby_task':1, 'grid_range': 'week'} + {'grid_range': 'week'}

@@ -122,14 +168,14 @@ pivot - + graph - + diff --git a/addons/hr_timesheet_attendance/report/hr_timesheet_attendance_report.py b/addons/hr_timesheet_attendance/report/hr_timesheet_attendance_report.py index 6601412fbad..18f1ef1bd2f 100644 --- a/addons/hr_timesheet_attendance/report/hr_timesheet_attendance_report.py +++ b/addons/hr_timesheet_attendance/report/hr_timesheet_attendance_report.py @@ -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) diff --git a/addons/hr_timesheet_attendance/report/hr_timesheet_attendance_report_view.xml b/addons/hr_timesheet_attendance/report/hr_timesheet_attendance_report_view.xml index 7417652c995..a66c4f12576 100644 --- a/addons/hr_timesheet_attendance/report/hr_timesheet_attendance_report_view.xml +++ b/addons/hr_timesheet_attendance/report/hr_timesheet_attendance_report_view.xml @@ -45,6 +45,7 @@ hr.timesheet.attendance.report + @@ -54,8 +55,8 @@ Timesheet / Attendance hr.timesheet.attendance.report graph,pivot - - {'search_default_group_by_month': True} + + {}

No data yet! @@ -65,6 +66,13 @@ + + + pivot + + + + graph diff --git a/addons/sale_timesheet/models/account.py b/addons/sale_timesheet/models/account.py index 15579ef4b90..5728e609289 100644 --- a/addons/sale_timesheet/models/account.py +++ b/addons/sale_timesheet/models/account.py @@ -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") diff --git a/addons/sale_timesheet/views/hr_timesheet_views.xml b/addons/sale_timesheet/views/hr_timesheet_views.xml index 9d9d1c4f931..aa3c7960f92 100644 --- a/addons/sale_timesheet/views/hr_timesheet_views.xml +++ b/addons/sale_timesheet/views/hr_timesheet_views.xml @@ -20,7 +20,7 @@ - + @@ -181,7 +181,6 @@ tree,form,pivot,graph,kanban [('project_id', '!=', False)] { - 'search_default_groupby_timesheet_invoice_type': 1, 'pivot_row_groupby': ['date:month'], } @@ -195,6 +194,19 @@ + + account.analytic.line.graph + account.analytic.line + + primary + + + + + + + + form @@ -219,7 +231,7 @@ graph - + diff --git a/odoo/addons/test_main_flows/static/tests/tours/main_flow.js b/odoo/addons/test_main_flows/static/tests/tours/main_flow.js index 488b1649eb5..bb170b1aeef 100644 --- a/odoo/addons/test_main_flows/static/tests/tours/main_flow.js +++ b/odoo/addons/test_main_flows/static/tests/tours/main_flow.js @@ -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,