diff --git a/models/__pycache__/res_users.cpython-312.pyc b/models/__pycache__/res_users.cpython-312.pyc index b7feec6..c4a4b78 100644 Binary files a/models/__pycache__/res_users.cpython-312.pyc and b/models/__pycache__/res_users.cpython-312.pyc differ diff --git a/models/__pycache__/restricted_models.cpython-312.pyc b/models/__pycache__/restricted_models.cpython-312.pyc index ef071ed..00ed705 100644 Binary files a/models/__pycache__/restricted_models.cpython-312.pyc and b/models/__pycache__/restricted_models.cpython-312.pyc differ diff --git a/models/__pycache__/sale_order.cpython-312.pyc b/models/__pycache__/sale_order.cpython-312.pyc index 4517426..81666e7 100644 Binary files a/models/__pycache__/sale_order.cpython-312.pyc and b/models/__pycache__/sale_order.cpython-312.pyc differ diff --git a/models/mrp_production.py b/models/mrp_production.py index 27a8b0e..ad4991a 100644 --- a/models/mrp_production.py +++ b/models/mrp_production.py @@ -13,3 +13,9 @@ class MrpProduction(models.Model): # If allowed_quality_checks is True, hide = False # If allowed_quality_checks is False, hide = True record.hide_quality_check_button = not self.env.user.allowed_quality_checks + + def action_confirm(self): + return super(MrpProduction, self.with_context(bypass_user_restriction=True)).action_confirm() + + def button_mark_done(self): + return super(MrpProduction, self.with_context(bypass_user_restriction=True)).button_mark_done() diff --git a/models/res_users.py b/models/res_users.py index 1b3c7d7..6e0724a 100644 --- a/models/res_users.py +++ b/models/res_users.py @@ -51,5 +51,6 @@ class ResUsers(models.Model): allowed_quality_checks = fields.Boolean( string="Is Allowed todo Quality Checks?", default=False, + prefetch=False, help="If checked, this user can see the Quality Checks button on Manufacturing Orders." ) diff --git a/models/restricted_models.py b/models/restricted_models.py index 295656c..c35d9bc 100644 --- a/models/restricted_models.py +++ b/models/restricted_models.py @@ -93,3 +93,9 @@ class ApprovalRequest(models.Model): if allowed_category_ids: domain = expression.AND([domain or [], [('category_id', 'in', allowed_category_ids)]]) return super()._search(domain, offset=offset, limit=limit, order=order) + + def action_confirm(self): + return super(ApprovalRequest, self.with_context(bypass_user_restriction=True)).action_confirm() + + def action_approve(self, approver=None): + return super(ApprovalRequest, self.with_context(bypass_user_restriction=True)).action_approve(approver=approver) diff --git a/models/sale_order.py b/models/sale_order.py index 21448b6..9193609 100644 --- a/models/sale_order.py +++ b/models/sale_order.py @@ -5,3 +5,6 @@ class SaleOrder(models.Model): def action_confirm(self): return super(SaleOrder, self.with_context(bypass_user_restriction=True)).action_confirm() + + def _action_confirm(self): + return super(SaleOrder, self.with_context(bypass_user_restriction=True))._action_confirm() diff --git a/models/stock_picking.py b/models/stock_picking.py index f759da1..1ba6472 100644 --- a/models/stock_picking.py +++ b/models/stock_picking.py @@ -10,3 +10,9 @@ class StockPicking(models.Model): def _compute_hide_quality_check_button(self): for record in self: record.hide_quality_check_button = not self.env.user.allowed_quality_checks + + def action_confirm(self): + return super(StockPicking, self.with_context(bypass_user_restriction=True)).action_confirm() + + def button_validate(self): + return super(StockPicking, self.with_context(bypass_user_restriction=True)).button_validate()