From 323b3fe86ec675cf7b1a78972db87d6d9f58d368 Mon Sep 17 00:00:00 2001 From: Lois Rilo Date: Tue, 12 Nov 2024 13:31:01 +0100 Subject: [PATCH] [FIX] mrp_multi_level: readd extensibility hook _should_create_planned_order hook was unnoticely removed in 33cf4af1accf415f056dfe497969e5933e40246f as it was not needed anymore in the base module. However it is still an extension point that can be used. --- mrp_multi_level/models/product_mrp_area.py | 4 ++++ mrp_multi_level/wizards/mrp_multi_level.py | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) 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():