[FIX] sale_timesheet: prevent error when adding timesheets w/o sale rights

Prior to this commit:

    - If a user without access to sales tries to add timesheets on a task that
      comes from a sale order, the following access error is raised:

        Access Error

        You are not allowed to access 'Sales Order Line' (sale.order.line) records.

After this commit:

    - A user without access to sales will be able to add timesheets to a task that
      comes from a sale order without any error.

task-2566750
opw-2525342

closes odoo/odoo#72025

X-original-commit: 9437bd543a40c3fc59979f70683be1acd7c995e7
Signed-off-by: LTU-Odoo <IT-Ideas@users.noreply.github.com>
Signed-off-by: Luis González [Vauxoo] <luisg123v@users.noreply.github.com>
This commit is contained in:
Luis González
2021-06-10 22:10:15 +00:00
committed by Laurent Stukkens (LTU)
parent 36bca6eb52
commit 7fc48345ad
+1 -1
View File
@@ -351,7 +351,7 @@ class ProjectTask(models.Model):
has_multi_sol = fields.Boolean(compute='_compute_has_multi_sol', compute_sudo=True)
allow_billable = fields.Boolean(related="project_id.allow_billable")
timesheet_product_id = fields.Many2one(related="project_id.timesheet_product_id")
remaining_hours_so = fields.Float('Remaining Hours on SO', compute='_compute_remaining_hours_so')
remaining_hours_so = fields.Float('Remaining Hours on SO', compute='_compute_remaining_hours_so', compute_sudo=True)
remaining_hours_available = fields.Boolean(related="sale_line_id.remaining_hours_available")
@api.depends('sale_line_id', 'timesheet_ids', 'timesheet_ids.unit_amount')