From 7fc48345add10ceaa7b7931ac51441f576fadaa1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Gonz=C3=A1lez?= Date: Thu, 6 May 2021 23:13:45 +0000 Subject: [PATCH] [FIX] sale_timesheet: prevent error when adding timesheets w/o sale rights MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Luis González [Vauxoo] --- addons/sale_timesheet/models/project.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/sale_timesheet/models/project.py b/addons/sale_timesheet/models/project.py index b05f57172f8..454ac1f475b 100644 --- a/addons/sale_timesheet/models/project.py +++ b/addons/sale_timesheet/models/project.py @@ -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')