mirror of
https://github.com/OCA/manufacture.git
synced 2025-01-28 16:37:15 +02:00
[FIX] mrp_multi_level: fix kit/phantom planning
fixes #1362 Ignoring qty_available for phantom products prevents double counting the qty_available of components. Creating planned orders for phantom products is simpler than recursively exploding phantom BOMs. This also makes it easier to analyze the planning data generated by the MRP calculation.
This commit is contained in:
committed by
JasminSForgeFlow
parent
34cc2cccd7
commit
c850eb0bb5
@@ -89,8 +89,11 @@ class MrpInventory(models.Model):
|
||||
@api.depends("planned_order_ids", "planned_order_ids.qty_released")
|
||||
def _compute_to_procure(self):
|
||||
for rec in self:
|
||||
rec.to_procure = sum(rec.planned_order_ids.mapped("mrp_qty")) - sum(
|
||||
rec.planned_order_ids.mapped("qty_released")
|
||||
rec.to_procure = (
|
||||
0.0
|
||||
if rec.supply_method == "phantom"
|
||||
else sum(rec.planned_order_ids.mapped("mrp_qty"))
|
||||
- sum(rec.planned_order_ids.mapped("qty_released"))
|
||||
)
|
||||
|
||||
@api.depends(
|
||||
|
||||
@@ -59,6 +59,7 @@ class MrpPlannedOrder(models.Model):
|
||||
mrp_action = fields.Selection(
|
||||
selection=[
|
||||
("manufacture", "Manufacturing Order"),
|
||||
("phantom", "Kit"),
|
||||
("buy", "Purchase Order"),
|
||||
("pull", "Pull From"),
|
||||
("push", "Push To"),
|
||||
|
||||
@@ -300,7 +300,3 @@ class ProductMRPArea(models.Model):
|
||||
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"
|
||||
|
||||
Reference in New Issue
Block a user