[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) <ltu@odoo.com>
This commit is contained in:
Vincent Larcin
2021-11-05 14:32:47 +00:00
parent b57f155075
commit d12c747002
2 changed files with 2 additions and 5 deletions
@@ -19,8 +19,7 @@
<h1 style="font-weight: bolder;">Activities</h1>
</div>
<div name="milestone">
<t t-if="milestones['show_section']">
<div name="milestone" t-if="milestones['show_section']">
<br/>
<h3 style="font-weight: bolder"><u>Milestones</u></h3>
@@ -67,7 +66,6 @@
</t>
</ul>
</t>
</t>
</div>
</template>
@@ -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 {