feat: Add bypass_user_restriction context to sale.order's _action_launch_stock_rule and stock.picking's and mrp.production's create methods.

This commit is contained in:
Suherdy Yacob 2026-01-29 08:50:52 +07:00
parent ea5a37bb70
commit 6ce00d0f2f
3 changed files with 11 additions and 0 deletions

View File

@ -15,3 +15,7 @@ class MrpProduction(models.Model):
def button_mark_done(self): def button_mark_done(self):
return super(MrpProduction, self.with_context(bypass_user_restriction=True)).button_mark_done() return super(MrpProduction, self.with_context(bypass_user_restriction=True)).button_mark_done()
@api.model_create_multi
def create(self, vals_list):
return super(MrpProduction, self.with_context(bypass_user_restriction=True)).create(vals_list)

View File

@ -8,3 +8,6 @@ class SaleOrder(models.Model):
def _action_confirm(self): def _action_confirm(self):
return super(SaleOrder, self.with_context(bypass_user_restriction=True))._action_confirm() return super(SaleOrder, self.with_context(bypass_user_restriction=True))._action_confirm()
def _action_launch_stock_rule(self, previous_product_uom_qty=False):
return super(SaleOrder, self.with_context(bypass_user_restriction=True))._action_launch_stock_rule(previous_product_uom_qty=previous_product_uom_qty)

View File

@ -15,3 +15,7 @@ class StockPicking(models.Model):
def button_validate(self): def button_validate(self):
return super(StockPicking, self.with_context(bypass_user_restriction=True)).button_validate() return super(StockPicking, self.with_context(bypass_user_restriction=True)).button_validate()
@api.model_create_multi
def create(self, vals_list):
return super(StockPicking, self.with_context(bypass_user_restriction=True)).create(vals_list)