[FIX] hr_timesheet: add compute_sudo for analytic_account_active compute

Before this commit, the portal user cannot access to the task form view
since he does not have any access to `account.analytic.account` model.

This commit adds `compute_sudo=True` in field definition of
`analytic_account_active` to bypass the access rights in its compute
method.

task-2379518

closes #73341
This commit is contained in:
Xavier BOL (xbo)
2021-08-26 14:59:33 +02:00
parent 4c5edbd0fc
commit c0e569dd90
+1 -1
View File
@@ -183,7 +183,7 @@ class Task(models.Model):
_name = "project.task"
_inherit = "project.task"
analytic_account_active = fields.Boolean("Active Analytic Account", compute='_compute_analytic_account_active')
analytic_account_active = fields.Boolean("Active Analytic Account", compute='_compute_analytic_account_active', compute_sudo=True)
allow_timesheets = fields.Boolean("Allow timesheets", related='project_id.allow_timesheets', help="Timesheets can be logged on this task.", readonly=True)
remaining_hours = fields.Float("Remaining Hours", compute='_compute_remaining_hours', store=True, readonly=True, help="Total remaining time, can be re-estimated periodically by the assignee of the task.")
effective_hours = fields.Float("Hours Spent", compute='_compute_effective_hours', compute_sudo=True, store=True, help="Time spent on this task, excluding its sub-tasks.")