diff --git a/mrp_multi_level/models/product_mrp_area.py b/mrp_multi_level/models/product_mrp_area.py index ec1fbe124f..ce8a2c9097 100644 --- a/mrp_multi_level/models/product_mrp_area.py +++ b/mrp_multi_level/models/product_mrp_area.py @@ -306,3 +306,7 @@ def _to_be_exploded(self): def _get_locations(self): self.ensure_one() return self.mrp_area_id._get_locations() + + def _should_create_planned_order(self): + self.ensure_one() + return True diff --git a/mrp_multi_level/wizards/mrp_multi_level.py b/mrp_multi_level/wizards/mrp_multi_level.py index 8f1eb279a8..bcd94fece2 100644 --- a/mrp_multi_level/wizards/mrp_multi_level.py +++ b/mrp_multi_level/wizards/mrp_multi_level.py @@ -266,7 +266,9 @@ def create_planned_order( order_data = self._prepare_planned_order_data( product_mrp_area_id, qty, mrp_date_supply, mrp_action_date, name, values ) - planned_order = self.env["mrp.planned.order"].create(order_data) + planned_order = False + if product_mrp_area_id._should_create_planned_order(): + planned_order = self.env["mrp.planned.order"].create(order_data) qty_ordered = qty_ordered + qty if product_mrp_area_id._to_be_exploded():