Skip to content

Commit

Permalink
Merge PR #1329 into 15.0
Browse files Browse the repository at this point in the history
Signed-off-by LoisRForgeFlow
  • Loading branch information
OCA-git-bot committed Jul 30, 2024
2 parents 8e918ca + efd9abc commit c38ec68
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
4 changes: 4 additions & 0 deletions mrp_multi_level/models/product_mrp_area.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,3 +300,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 not self.supply_method == "phantom"
17 changes: 10 additions & 7 deletions mrp_multi_level/wizards/mrp_multi_level.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ def create_planned_order(
)
# Do not create planned order for products that are Kits
planned_order = False
if not product_mrp_area_id.supply_method == "phantom":
if product_mrp_area_id._should_create_planned_order():
planned_order = self.env["mrp.planned.order"].create(order_data)
qty_ordered = qty_ordered + qty

Expand Down Expand Up @@ -873,6 +873,14 @@ def _init_mrp_inventory(self, product_mrp_area):
if invs:
po.mrp_inventory_id = invs[0]

def should_build_time_phased_inventory(self, product_mrp_area):
return not (
self._exclude_from_mrp(
product_mrp_area.product_id, product_mrp_area.mrp_area_id
)
or product_mrp_area.supply_method == "phantom"
)

@api.model
def _mrp_final_process(self, mrp_areas):
logger.info("Start MRP final process")
Expand All @@ -883,12 +891,7 @@ def _mrp_final_process(self, mrp_areas):

for product_mrp_area in product_mrp_area_ids:
# Build the time-phased inventory
if (
self._exclude_from_mrp(
product_mrp_area.product_id, product_mrp_area.mrp_area_id
)
or product_mrp_area.supply_method == "phantom"
):
if not self.should_build_time_phased_inventory(product_mrp_area):
continue
self._init_mrp_inventory(product_mrp_area)
logger.info("End MRP final process")
Expand Down

0 comments on commit c38ec68

Please sign in to comment.