diff --git a/addons/mrp/models/mrp_production.py b/addons/mrp/models/mrp_production.py index 7061d7aec07..0d92bbe6aae 100644 --- a/addons/mrp/models/mrp_production.py +++ b/addons/mrp/models/mrp_production.py @@ -1551,7 +1551,7 @@ class MrpProduction(models.Model): backorder_sequence=next_seq )) - backorders = self.env['mrp.production'].create(backorder_vals_list) + backorders = self.env['mrp.production'].with_context(skip_confirm=True).create(backorder_vals_list) index = 0 production_to_backorders = {} diff --git a/addons/mrp/models/mrp_workorder.py b/addons/mrp/models/mrp_workorder.py index 4783a0879c8..e3a7a811b60 100644 --- a/addons/mrp/models/mrp_workorder.py +++ b/addons/mrp/models/mrp_workorder.py @@ -448,6 +448,8 @@ class MrpWorkorder(models.Model): # Auto-confirm manually added workorders. # We need to go through `_action_confirm` for all workorders of the current productions to # make sure the links between them are correct. + if self.env.context.get('skip_confirm'): + return res to_confirm = res.filtered(lambda wo: wo.production_id.state in ("confirmed", "progress", "to_close")) to_confirm = to_confirm.production_id.workorder_ids to_confirm._action_confirm()