From 20fd01b1141027f895ec8fca6b4b2d6bb6279299 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Mart=C3=ADnez?= Date: Tue, 30 May 2023 13:41:07 +0200 Subject: [PATCH] [IMP] stock_request: Apply sudo to prevent requests ACL errors if the user does not have permissions (example: productions). TT43655 --- stock_request/models/stock_move.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/stock_request/models/stock_move.py b/stock_request/models/stock_move.py index 50b831a05..930a33148 100644 --- a/stock_request/models/stock_move.py +++ b/stock_request/models/stock_move.py @@ -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