From d12c7470028f2b6224c7bd7702212ff10c82e4ae Mon Sep 17 00:00:00 2001 From: Vincent Larcin Date: Fri, 22 Oct 2021 13:44:43 +0000 Subject: [PATCH] [FIX] sale_timesheet: remove empty sections from project updates With the sale_timesheet module installed, some Project Updates can contain an "Activities" section in the description, despite there being no activities to be shown, and some empty divs. This commit will remove all of those unnecessary sections, which also spares us an expensive call to `project._get_profitability_common()`. Task-2675389 closes odoo/odoo#79415 X-original-commit: 0741dde0598186d395a06ab6a9ea7056f0ff00ff Signed-off-by: Laurent Stukkens (ltu) --- addons/project/views/project_update_templates.xml | 4 +--- addons/sale_timesheet/models/project_update.py | 3 +-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/addons/project/views/project_update_templates.xml b/addons/project/views/project_update_templates.xml index 5e1cac3d331..36056ce4b00 100644 --- a/addons/project/views/project_update_templates.xml +++ b/addons/project/views/project_update_templates.xml @@ -19,8 +19,7 @@

Activities

-
- +

Milestones

@@ -67,7 +66,6 @@ -
diff --git a/addons/sale_timesheet/models/project_update.py b/addons/sale_timesheet/models/project_update.py index 4c3ba0d24be..5ab1ca81325 100644 --- a/addons/sale_timesheet/models/project_update.py +++ b/addons/sale_timesheet/models/project_update.py @@ -62,8 +62,7 @@ class ProjectUpdate(models.Model): @api.model def _get_profitability_values(self, project): costs_revenues = project.analytic_account_id and project.allow_billable - timesheets = project.allow_timesheets and self.user_has_groups('hr_timesheet.group_hr_timesheet_user') - if not (self.user_has_groups('project.group_project_manager') and (costs_revenues or timesheets)): + if not (self.user_has_groups('project.group_project_manager') and costs_revenues): return {} profitability = project._get_profitability_common() return {