[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 <alt-odoo@users.noreply.github.com>
This commit is contained in:
alt-odoo
2020-09-04 16:47:06 +00:00
parent cab75e7969
commit 58fb79aa78
+1 -1
View File
@@ -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,
})