From cb12ab2f1c4ee16c4c91f383b197e9fcfcce66a9 Mon Sep 17 00:00:00 2001 From: Kartik Chavda Date: Fri, 2 Sep 2022 06:07:32 +0000 Subject: [PATCH] [IMP] {hr,sale}_timesheet{,_attendance}: improve generic UX Purpose of this commit is to do generic UX. So, in this commit done following points: - improve search on invoice for portal commit when invoice is in draft then search on id of invoice instead of name. - display unit_amount field in muted when value of unit_amount is equal to 0. - rename timesheet attendance report. task-2969791 closes odoo/odoo#100141 Related: odoo/upgrade#3897 Related: odoo/enterprise#31304 Signed-off-by: Xavier Bol (xbo) --- .../hr_timesheet/views/hr_timesheet_views.xml | 23 ++++--------------- .../hr_timesheet_attendance_report_view.xml | 4 ++-- addons/sale_timesheet/controllers/portal.py | 2 +- .../views/sale_timesheet_portal_templates.xml | 4 +++- 4 files changed, 11 insertions(+), 22 deletions(-) diff --git a/addons/hr_timesheet/views/hr_timesheet_views.xml b/addons/hr_timesheet/views/hr_timesheet_views.xml index 379931a88ec..6d80944bb43 100644 --- a/addons/hr_timesheet/views/hr_timesheet_views.xml +++ b/addons/hr_timesheet/views/hr_timesheet_views.xml @@ -12,7 +12,8 @@ - + @@ -132,7 +133,7 @@ + attrs="{'readonly': [('readonly_timesheet', '=', True)]}" decoration-muted="unit_amount == 0"/> @@ -251,7 +252,7 @@ - Duration: + Duration: @@ -268,7 +269,7 @@ My Timesheets account.analytic.line - tree,form,kanban,pivot,graph + tree,form,kanban [('project_id', '!=', False), ('user_id', '=', uid)] { "search_default_week":1, @@ -306,20 +307,6 @@ - - pivot - 7 - - - - - - graph - 8 - - - - Task's Timesheets account.analytic.line 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 42bd5c9a0b8..1a442aa2849 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 @@ -58,7 +58,7 @@ - Timesheet / Attendance + Timesheets / Attendance Analysis hr.timesheet.attendance.report graph,pivot @@ -88,6 +88,6 @@ + name="Timesheets / Attendance Analysis"/> diff --git a/addons/sale_timesheet/controllers/portal.py b/addons/sale_timesheet/controllers/portal.py index e5318ec4362..c0f94f71f57 100644 --- a/addons/sale_timesheet/controllers/portal.py +++ b/addons/sale_timesheet/controllers/portal.py @@ -82,7 +82,7 @@ class SaleTimesheetCustomerPortal(TimesheetCustomerPortal): if search_in in ('so', 'all'): search_domain = expression.OR([search_domain, [('so_line.order_id.name', 'ilike', search)]]) if search_in in ('invoice', 'all'): - invoices = request.env['account.move'].sudo().search([('name', 'ilike', search)]) + invoices = request.env['account.move'].sudo().search(['|', ('name', 'ilike', search), ('id', 'ilike', search)]) domain = request.env['account.analytic.line']._timesheet_get_sale_domain(invoices.mapped('invoice_line_ids.sale_line_ids'), invoices) search_domain = expression.OR([search_domain, domain]) return search_domain diff --git a/addons/sale_timesheet/views/sale_timesheet_portal_templates.xml b/addons/sale_timesheet/views/sale_timesheet_portal_templates.xml index b6ee55cc66f..68d668de2e3 100644 --- a/addons/sale_timesheet/views/sale_timesheet_portal_templates.xml +++ b/addons/sale_timesheet/views/sale_timesheet_portal_templates.xml @@ -94,8 +94,10 @@
  • + + View Timesheets + target="_blank" t-att-href="'/my/timesheets?search_in=invoice&search=%s' % search_value">View Timesheets