From 58fb79aa78d282fdad5210bb418aec23d0818d29 Mon Sep 17 00:00:00 2001 From: alt-odoo Date: Fri, 4 Sep 2020 05:18:01 +0000 Subject: [PATCH] [FIX] mrp: no error on workorders scheduled start date update When a user is accessing a work order in state ready, we are updating it and rewriting date_planned_start field. We also update accordingly the associated slot of the workcenter calendar (leave_id), but if the ressource of this slot is linked to another user, a record rule on resource.calendar.leaves is preventing the update, which should occur without error, even if the user does not have Time Off / All Approver rights. closes odoo/odoo#57120 X-original-commit: 790fb1820fbd49d07206963077216cc304ed2b0a Signed-off-by: Alex Tuyls --- addons/mrp/models/mrp_workorder.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mrp/models/mrp_workorder.py b/addons/mrp/models/mrp_workorder.py index 713f12c10f0..09a43fafb6e 100644 --- a/addons/mrp/models/mrp_workorder.py +++ b/addons/mrp/models/mrp_workorder.py @@ -239,7 +239,7 @@ class MrpWorkorder(models.Model): def _set_dates_planned(self): date_from = self[0].date_planned_start date_to = self[0].date_planned_finished - self.mapped('leave_id').write({ + self.mapped('leave_id').sudo().write({ 'date_from': date_from, 'date_to': date_to, })