[IMP] stock_request: Apply sudo to prevent requests ACL errors if the user does not have permissions (example: productions).

TT43655
This commit is contained in:
Víctor Martínez
2023-05-30 13:41:07 +02:00
parent 97901ec3a6
commit 20fd01b114

View File

@@ -68,11 +68,15 @@ class StockMove(models.Model):
return super(StockMove, self).copy_data(default)
def _action_cancel(self):
"""Apply sudo to prevent requests ACL errors if the user does not have
permissions (example: productions)."""
res = super()._action_cancel()
self.mapped("allocation_ids.stock_request_id").check_cancel()
self.mapped("allocation_ids.stock_request_id").sudo().check_cancel()
return res
def _action_done(self, cancel_backorder=False):
"""Apply sudo to prevent requests ACL errors if the user does not have
permissions (example: productions)."""
res = super()._action_done(cancel_backorder=cancel_backorder)
self.mapped("allocation_ids.stock_request_id").check_done()
self.mapped("allocation_ids.stock_request_id").sudo().check_done()
return res