From 095efcd65cf6db20e17e30b5fc2733b6ccb6c8fe Mon Sep 17 00:00:00 2001 From: "Rohitkumar (roku)" Date: Mon, 11 Apr 2022 12:18:14 +0000 Subject: [PATCH] [IMP] project,sale,hr(_timesheet): improve the UX for project Purpose of this commit to improve generic usage of project app. So in this commit done following changes: - rename 'total hours' into 'total hours spent' (or 'total days spent' if the timesheet encoding unit is in days) for project.task - timesheets (billed on timesheets) section > group the graph view by invoice > employee - add default action project update > profitability> timesheets (billed on timesheets) section > group the grid view by invoice > employee (display sections) - add default the 'timesheet costs' measure in pivot view - display 'hours remaining' in red if the number is negative for project.task form view - display the 'week' scale by default in the grid view task-2819458 closes odoo/odoo#90270 Related: odoo/enterprise#26795 Signed-off-by: Laurent Stukkens (ltu) --- addons/hr_timesheet/models/project.py | 2 +- addons/hr_timesheet/views/project_views.xml | 4 +-- addons/project/views/project_views.xml | 4 +-- addons/sale_timesheet/models/project.py | 4 +-- addons/sale_timesheet/models/sale_order.py | 27 ++++++++++++------- .../views/hr_timesheet_views.xml | 27 ++++++++++++++++++- 6 files changed, 49 insertions(+), 19 deletions(-) diff --git a/addons/hr_timesheet/models/project.py b/addons/hr_timesheet/models/project.py index 5fa42965e8f..1975b6882a5 100644 --- a/addons/hr_timesheet/models/project.py +++ b/addons/hr_timesheet/models/project.py @@ -242,7 +242,7 @@ class Task(models.Model): remaining_hours = fields.Float("Remaining Hours", compute='_compute_remaining_hours', store=True, readonly=True, help="Number of allocated hours minus the number of hours spent.") remaining_hours_percentage = fields.Float(compute='_compute_remaining_hours_percentage', search='_search_remaining_hours_percentage') effective_hours = fields.Float("Hours Spent", compute='_compute_effective_hours', compute_sudo=True, store=True) - total_hours_spent = fields.Float("Total Hours", compute='_compute_total_hours_spent', store=True, help="Time spent on this task and its sub-tasks (and their own sub-tasks).") + total_hours_spent = fields.Float("Total Hours Spent", compute='_compute_total_hours_spent', store=True, help="Time spent on this task and its sub-tasks (and their own sub-tasks).") progress = fields.Float("Progress", compute='_compute_progress_hours', store=True, group_operator="avg") overtime = fields.Float(compute='_compute_progress_hours', store=True) subtask_effective_hours = fields.Float("Sub-tasks Hours Spent", compute='_compute_subtask_effective_hours', recursive=True, store=True, help="Time spent on the sub-tasks (and their own sub-tasks) of this task.") diff --git a/addons/hr_timesheet/views/project_views.xml b/addons/hr_timesheet/views/project_views.xml index e195e915135..8d2d1a50e71 100644 --- a/addons/hr_timesheet/views/project_views.xml +++ b/addons/hr_timesheet/views/project_views.xml @@ -115,7 +115,7 @@ - + @@ -241,7 +241,7 @@ attrs="{'invisible': ['|', '|', ('planned_hours', '=', 0.0), ('encode_uom_in_days', '=', False), ('remaining_hours', '>=', 0)]}"/> + attrs="{'invisible' : [('planned_hours', '=', 0.0)]}" nolabel="1" decoration-danger="remaining_hours < 0"/> diff --git a/addons/project/views/project_views.xml b/addons/project/views/project_views.xml index d7323e577a6..dadb5e9f098 100644 --- a/addons/project/views/project_views.xml +++ b/addons/project/views/project_views.xml @@ -533,7 +533,7 @@