mirror of
https://github.com/OCA/manufacture.git
synced 2025-01-28 16:37:15 +02:00
[FIX] mrp_multi_level: Manage Kits in MRP Multi Level
This commit is contained in:
@@ -40,6 +40,28 @@
|
|||||||
<field name="sequence">5</field>
|
<field name="sequence">5</field>
|
||||||
<field name="bom_id" ref="mrp_bom_fp_2" />
|
<field name="bom_id" ref="mrp_bom_fp_2" />
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
<!-- FP-3 -->
|
||||||
|
<record id="mrp_bom_fp_3" model="mrp.bom">
|
||||||
|
<field name="product_tmpl_id" ref="product_product_fp_3_product_template" />
|
||||||
|
<field name="product_uom_id" ref="uom.product_uom_unit" />
|
||||||
|
<field name="sequence">5</field>
|
||||||
|
</record>
|
||||||
|
<record id="mrp_bom_fp_3_line_sf_3" model="mrp.bom.line">
|
||||||
|
<field name="product_id" ref="product_product_sf_3" />
|
||||||
|
<field name="product_qty">2</field>
|
||||||
|
<field name="product_uom_id" ref="uom.product_uom_unit" />
|
||||||
|
<field name="sequence">5</field>
|
||||||
|
<field name="bom_id" ref="mrp_bom_fp_3" />
|
||||||
|
</record>
|
||||||
|
<record id="mrp_bom_fp_3_line_pp_3" model="mrp.bom.line">
|
||||||
|
<field name="product_id" ref="product_product_pp_3" />
|
||||||
|
<field name="product_qty">2</field>
|
||||||
|
<field name="product_uom_id" ref="uom.product_uom_unit" />
|
||||||
|
<field name="sequence">5</field>
|
||||||
|
<field name="bom_id" ref="mrp_bom_fp_3" />
|
||||||
|
</record>
|
||||||
|
|
||||||
<!-- Customizable Desk -->
|
<!-- Customizable Desk -->
|
||||||
<record id="mrp_bom_product_4" model="mrp.bom">
|
<record id="mrp_bom_product_4" model="mrp.bom">
|
||||||
<field
|
<field
|
||||||
@@ -126,4 +148,25 @@
|
|||||||
<field name="sequence">5</field>
|
<field name="sequence">5</field>
|
||||||
<field name="bom_id" ref="mrp_bom_sf_2" />
|
<field name="bom_id" ref="mrp_bom_sf_2" />
|
||||||
</record>
|
</record>
|
||||||
|
<!-- SF-3 -->
|
||||||
|
<record id="mrp_bom_sf_3" model="mrp.bom">
|
||||||
|
<field name="product_tmpl_id" ref="product_product_sf_3_product_template" />
|
||||||
|
<field name="product_uom_id" ref="uom.product_uom_unit" />
|
||||||
|
<field name="type">phantom</field>
|
||||||
|
<field name="sequence">5</field>
|
||||||
|
</record>
|
||||||
|
<record id="mrp_bom_sf_3_line_pp_3" model="mrp.bom.line">
|
||||||
|
<field name="product_id" ref="product_product_pp_3" />
|
||||||
|
<field name="product_qty">1</field>
|
||||||
|
<field name="product_uom_id" ref="uom.product_uom_unit" />
|
||||||
|
<field name="sequence">5</field>
|
||||||
|
<field name="bom_id" ref="mrp_bom_sf_3" />
|
||||||
|
</record>
|
||||||
|
<record id="mrp_bom_sf_3_line_pp_4" model="mrp.bom.line">
|
||||||
|
<field name="product_id" ref="product_product_pp_4" />
|
||||||
|
<field name="product_qty">3</field>
|
||||||
|
<field name="product_uom_id" ref="uom.product_uom_unit" />
|
||||||
|
<field name="sequence">5</field>
|
||||||
|
<field name="bom_id" ref="mrp_bom_sf_3" />
|
||||||
|
</record>
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|||||||
@@ -8,6 +8,10 @@
|
|||||||
<field name="product_id" ref="product_product_fp_2" />
|
<field name="product_id" ref="product_product_fp_2" />
|
||||||
<field name="mrp_area_id" ref="mrp_area_stock_wh0" />
|
<field name="mrp_area_id" ref="mrp_area_stock_wh0" />
|
||||||
</record>
|
</record>
|
||||||
|
<record id="product_mrp_area_fp_3" model="product.mrp.area">
|
||||||
|
<field name="product_id" ref="product_product_fp_3" />
|
||||||
|
<field name="mrp_area_id" ref="mrp_area_stock_wh0" />
|
||||||
|
</record>
|
||||||
<record id="product_mrp_area_product_4" model="product.mrp.area">
|
<record id="product_mrp_area_product_4" model="product.mrp.area">
|
||||||
<field name="product_id" ref="product.product_product_4" />
|
<field name="product_id" ref="product.product_product_4" />
|
||||||
<field name="mrp_area_id" ref="mrp_area_stock_wh0" />
|
<field name="mrp_area_id" ref="mrp_area_stock_wh0" />
|
||||||
@@ -32,6 +36,10 @@
|
|||||||
<field name="product_id" ref="product_product_sf_2" />
|
<field name="product_id" ref="product_product_sf_2" />
|
||||||
<field name="mrp_area_id" ref="mrp_area_stock_wh0" />
|
<field name="mrp_area_id" ref="mrp_area_stock_wh0" />
|
||||||
</record>
|
</record>
|
||||||
|
<record id="product_mrp_area_sf_3" model="product.mrp.area">
|
||||||
|
<field name="product_id" ref="product_product_sf_3" />
|
||||||
|
<field name="mrp_area_id" ref="mrp_area_stock_wh0" />
|
||||||
|
</record>
|
||||||
<record id="product_mrp_area_pp_1" model="product.mrp.area">
|
<record id="product_mrp_area_pp_1" model="product.mrp.area">
|
||||||
<field name="product_id" ref="product_product_pp_1" />
|
<field name="product_id" ref="product_product_pp_1" />
|
||||||
<field name="mrp_area_id" ref="mrp_area_stock_wh0" />
|
<field name="mrp_area_id" ref="mrp_area_stock_wh0" />
|
||||||
@@ -40,6 +48,14 @@
|
|||||||
<field name="product_id" ref="product_product_pp_2" />
|
<field name="product_id" ref="product_product_pp_2" />
|
||||||
<field name="mrp_area_id" ref="mrp_area_stock_wh0" />
|
<field name="mrp_area_id" ref="mrp_area_stock_wh0" />
|
||||||
</record>
|
</record>
|
||||||
|
<record id="product_mrp_area_pp_3" model="product.mrp.area">
|
||||||
|
<field name="product_id" ref="product_product_pp_3" />
|
||||||
|
<field name="mrp_area_id" ref="mrp_area_stock_wh0" />
|
||||||
|
</record>
|
||||||
|
<record id="product_mrp_area_pp_4" model="product.mrp.area">
|
||||||
|
<field name="product_id" ref="product_product_pp_4" />
|
||||||
|
<field name="mrp_area_id" ref="mrp_area_stock_wh0" />
|
||||||
|
</record>
|
||||||
<record id="product_mrp_area_av_11" model="product.mrp.area">
|
<record id="product_mrp_area_av_11" model="product.mrp.area">
|
||||||
<field name="product_id" ref="product_product_av_11" />
|
<field name="product_id" ref="product_product_av_11" />
|
||||||
<field name="mrp_area_id" ref="mrp_area_stock_wh0" />
|
<field name="mrp_area_id" ref="mrp_area_stock_wh0" />
|
||||||
|
|||||||
@@ -24,6 +24,19 @@
|
|||||||
eval="[(6, 0, [ref('mrp.route_warehouse0_manufacture')])]"
|
eval="[(6, 0, [ref('mrp.route_warehouse0_manufacture')])]"
|
||||||
/>
|
/>
|
||||||
</record>
|
</record>
|
||||||
|
<record id="product_product_fp_3" model="product.product">
|
||||||
|
<field name="name">FP-3</field>
|
||||||
|
<field name="categ_id" ref="product_category_mrp" />
|
||||||
|
<field name="type">product</field>
|
||||||
|
<field name="uom_id" ref="uom.product_uom_unit" />
|
||||||
|
<field name="uom_po_id" ref="uom.product_uom_unit" />
|
||||||
|
<field name="produce_delay">3</field>
|
||||||
|
<field
|
||||||
|
name="route_ids"
|
||||||
|
eval="[(6, 0, [ref('mrp.route_warehouse0_manufacture')])]"
|
||||||
|
/>
|
||||||
|
</record>
|
||||||
|
|
||||||
<!-- Customizable Desk -->
|
<!-- Customizable Desk -->
|
||||||
<record id="product.product_product_4_product_template" model="product.template">
|
<record id="product.product_product_4_product_template" model="product.template">
|
||||||
<field
|
<field
|
||||||
@@ -55,6 +68,19 @@
|
|||||||
eval="[(6, 0, [ref('mrp.route_warehouse0_manufacture')])]"
|
eval="[(6, 0, [ref('mrp.route_warehouse0_manufacture')])]"
|
||||||
/>
|
/>
|
||||||
</record>
|
</record>
|
||||||
|
<record id="product_product_sf_3" model="product.product">
|
||||||
|
<field name="name">SF-3</field>
|
||||||
|
<field name="categ_id" ref="product_category_mrp" />
|
||||||
|
<field name="type">product</field>
|
||||||
|
<field name="uom_id" ref="uom.product_uom_unit" />
|
||||||
|
<field name="uom_po_id" ref="uom.product_uom_unit" />
|
||||||
|
<field name="produce_delay">3</field>
|
||||||
|
<field
|
||||||
|
name="route_ids"
|
||||||
|
eval="[(6, 0, [ref('mrp.route_warehouse0_manufacture')])]"
|
||||||
|
/>
|
||||||
|
</record>
|
||||||
|
|
||||||
<record id="product_product_pp_1" model="product.product">
|
<record id="product_product_pp_1" model="product.product">
|
||||||
<field name="name">PP-1</field>
|
<field name="name">PP-1</field>
|
||||||
<field name="categ_id" ref="product_category_mrp" />
|
<field name="categ_id" ref="product_category_mrp" />
|
||||||
@@ -77,6 +103,31 @@
|
|||||||
eval="[(6, 0, [ref('purchase_stock.route_warehouse0_buy')])]"
|
eval="[(6, 0, [ref('purchase_stock.route_warehouse0_buy')])]"
|
||||||
/>
|
/>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
<record id="product_product_pp_3" model="product.product">
|
||||||
|
<field name="name">PP-3</field>
|
||||||
|
<field name="categ_id" ref="product_category_mrp" />
|
||||||
|
<field name="type">product</field>
|
||||||
|
<field name="uom_id" ref="uom.product_uom_unit" />
|
||||||
|
<field name="uom_po_id" ref="uom.product_uom_unit" />
|
||||||
|
<field
|
||||||
|
name="route_ids"
|
||||||
|
eval="[(6, 0, [ref('purchase_stock.route_warehouse0_buy')])]"
|
||||||
|
/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="product_product_pp_4" model="product.product">
|
||||||
|
<field name="name">PP-4</field>
|
||||||
|
<field name="categ_id" ref="product_category_mrp" />
|
||||||
|
<field name="type">product</field>
|
||||||
|
<field name="uom_id" ref="uom.product_uom_unit" />
|
||||||
|
<field name="uom_po_id" ref="uom.product_uom_unit" />
|
||||||
|
<field
|
||||||
|
name="route_ids"
|
||||||
|
eval="[(6, 0, [ref('purchase_stock.route_warehouse0_buy')])]"
|
||||||
|
/>
|
||||||
|
</record>
|
||||||
|
|
||||||
<record id="product_product_av_11" model="product.product">
|
<record id="product_product_av_11" model="product.product">
|
||||||
<field name="name">AV-11 steel</field>
|
<field name="name">AV-11 steel</field>
|
||||||
<field name="categ_id" ref="product_category_mrp" />
|
<field name="categ_id" ref="product_category_mrp" />
|
||||||
|
|||||||
@@ -42,4 +42,20 @@
|
|||||||
<field name="min_qty">0</field>
|
<field name="min_qty">0</field>
|
||||||
<field name="price">100</field>
|
<field name="price">100</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
<record id="product_supplierinfo_pp_3" model="product.supplierinfo">
|
||||||
|
<field name="product_tmpl_id" ref="product_product_pp_3_product_template" />
|
||||||
|
<field name="name" ref="res_partner_lazer_tech" />
|
||||||
|
<field name="delay">2</field>
|
||||||
|
<field name="min_qty">0</field>
|
||||||
|
<field name="price">10</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="product_supplierinfo_pp_4" model="product.supplierinfo">
|
||||||
|
<field name="product_tmpl_id" ref="product_product_pp_4_product_template" />
|
||||||
|
<field name="name" ref="res_partner_lazer_tech" />
|
||||||
|
<field name="delay">3</field>
|
||||||
|
<field name="min_qty">0</field>
|
||||||
|
<field name="price">80</field>
|
||||||
|
</record>
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|||||||
@@ -78,6 +78,7 @@ class ProductMRPArea(models.Model):
|
|||||||
("buy", "Buy"),
|
("buy", "Buy"),
|
||||||
("none", "Undefined"),
|
("none", "Undefined"),
|
||||||
("manufacture", "Produce"),
|
("manufacture", "Produce"),
|
||||||
|
("phantom", "Kit"),
|
||||||
("pull", "Pull From"),
|
("pull", "Pull From"),
|
||||||
("push", "Push To"),
|
("push", "Push To"),
|
||||||
("pull_push", "Pull & Push"),
|
("pull_push", "Pull & Push"),
|
||||||
@@ -182,6 +183,13 @@ class ProductMRPArea(models.Model):
|
|||||||
"company_id": rec.mrp_area_id.company_id,
|
"company_id": rec.mrp_area_id.company_id,
|
||||||
}
|
}
|
||||||
rule = group_obj._get_rule(rec.product_id, proc_loc, values)
|
rule = group_obj._get_rule(rec.product_id, proc_loc, values)
|
||||||
|
if (
|
||||||
|
rule.action == "manufacture"
|
||||||
|
and rec.product_id.product_tmpl_id.bom_ids
|
||||||
|
and rec.product_id.product_tmpl_id.bom_ids[0].type == "phantom"
|
||||||
|
):
|
||||||
|
rec.supply_method = "phantom"
|
||||||
|
else:
|
||||||
rec.supply_method = rule.action if rule else "none"
|
rec.supply_method = rule.action if rule else "none"
|
||||||
|
|
||||||
@api.depends("supply_method", "product_id.route_ids", "product_id.seller_ids")
|
@api.depends("supply_method", "product_id.route_ids", "product_id.seller_ids")
|
||||||
@@ -263,7 +271,4 @@ class ProductMRPArea(models.Model):
|
|||||||
|
|
||||||
def _to_be_exploded(self):
|
def _to_be_exploded(self):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
if self.supply_method == "manufacture":
|
return self.supply_method in ["manufacture", "phantom"]
|
||||||
return True
|
|
||||||
else:
|
|
||||||
return False
|
|
||||||
|
|||||||
@@ -28,10 +28,14 @@ class TestMrpMultiLevelCommon(SavepointCase):
|
|||||||
|
|
||||||
cls.fp_1 = cls.env.ref("mrp_multi_level.product_product_fp_1")
|
cls.fp_1 = cls.env.ref("mrp_multi_level.product_product_fp_1")
|
||||||
cls.fp_2 = cls.env.ref("mrp_multi_level.product_product_fp_2")
|
cls.fp_2 = cls.env.ref("mrp_multi_level.product_product_fp_2")
|
||||||
|
cls.fp_3 = cls.env.ref("mrp_multi_level.product_product_fp_3")
|
||||||
cls.sf_1 = cls.env.ref("mrp_multi_level.product_product_sf_1")
|
cls.sf_1 = cls.env.ref("mrp_multi_level.product_product_sf_1")
|
||||||
cls.sf_2 = cls.env.ref("mrp_multi_level.product_product_sf_2")
|
cls.sf_2 = cls.env.ref("mrp_multi_level.product_product_sf_2")
|
||||||
|
cls.sf_3 = cls.env.ref("mrp_multi_level.product_product_sf_3")
|
||||||
cls.pp_1 = cls.env.ref("mrp_multi_level.product_product_pp_1")
|
cls.pp_1 = cls.env.ref("mrp_multi_level.product_product_pp_1")
|
||||||
cls.pp_2 = cls.env.ref("mrp_multi_level.product_product_pp_2")
|
cls.pp_2 = cls.env.ref("mrp_multi_level.product_product_pp_2")
|
||||||
|
cls.pp_3 = cls.env.ref("mrp_multi_level.product_product_pp_3")
|
||||||
|
cls.pp_4 = cls.env.ref("mrp_multi_level.product_product_pp_4")
|
||||||
cls.product_4b = cls.env.ref("product.product_product_4b")
|
cls.product_4b = cls.env.ref("product.product_product_4b")
|
||||||
cls.av_11 = cls.env.ref("mrp_multi_level.product_product_av_11")
|
cls.av_11 = cls.env.ref("mrp_multi_level.product_product_av_11")
|
||||||
cls.av_12 = cls.env.ref("mrp_multi_level.product_product_av_12")
|
cls.av_12 = cls.env.ref("mrp_multi_level.product_product_av_12")
|
||||||
@@ -271,6 +275,19 @@ class TestMrpMultiLevelCommon(SavepointCase):
|
|||||||
"location_dest_id": cls.customer_location.id,
|
"location_dest_id": cls.customer_location.id,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
(
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
{
|
||||||
|
"name": "Test move fp-3",
|
||||||
|
"product_id": cls.fp_3.id,
|
||||||
|
"date": date_move,
|
||||||
|
"product_uom": cls.fp_3.uom_id.id,
|
||||||
|
"product_uom_qty": 5,
|
||||||
|
"location_id": cls.stock_location.id,
|
||||||
|
"location_dest_id": cls.customer_location.id,
|
||||||
|
},
|
||||||
|
),
|
||||||
(
|
(
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
|
|||||||
@@ -389,3 +389,42 @@ class TestMrpMultiLevel(TestMrpMultiLevelCommon):
|
|||||||
self.assertEqual(len(prod_uom_test_inventory_lines), 1)
|
self.assertEqual(len(prod_uom_test_inventory_lines), 1)
|
||||||
self.assertEqual(prod_uom_test_inventory_lines.supply_qty, 12.0)
|
self.assertEqual(prod_uom_test_inventory_lines.supply_qty, 12.0)
|
||||||
# Supply qty has to be 12 has a dozen of units are in a RFQ.
|
# Supply qty has to be 12 has a dozen of units are in a RFQ.
|
||||||
|
|
||||||
|
def test_16_phantom_comp_planning(self):
|
||||||
|
"""
|
||||||
|
Phantom components will not appear in MRP Inventory or Planned Orders.
|
||||||
|
MRP Parameter will have 'phantom' supply method.
|
||||||
|
"""
|
||||||
|
# SF-3
|
||||||
|
sf_3_line_1 = self.mrp_inventory_obj.search(
|
||||||
|
[("product_mrp_area_id.product_id", "=", self.sf_3.id)]
|
||||||
|
)
|
||||||
|
self.assertEqual(len(sf_3_line_1), 0)
|
||||||
|
sf_3_planned_order_1 = self.planned_order_obj.search(
|
||||||
|
[("product_mrp_area_id.product_id", "=", self.sf_3.id)]
|
||||||
|
)
|
||||||
|
self.assertEqual(len(sf_3_planned_order_1), 0)
|
||||||
|
sf_3_mrp_parameter = self.product_mrp_area_obj.search(
|
||||||
|
[("product_id", "=", self.sf_3.id)]
|
||||||
|
)
|
||||||
|
self.assertEqual(sf_3_mrp_parameter.supply_method, "phantom")
|
||||||
|
# PP-3
|
||||||
|
pp_3_line_1 = self.mrp_inventory_obj.search(
|
||||||
|
[("product_mrp_area_id.product_id", "=", self.pp_3.id)]
|
||||||
|
)
|
||||||
|
self.assertEqual(len(pp_3_line_1), 1)
|
||||||
|
self.assertEqual(pp_3_line_1.demand_qty, 20.0)
|
||||||
|
pp_3_planned_orders = self.planned_order_obj.search(
|
||||||
|
[("product_mrp_area_id.product_id", "=", self.pp_3.id)]
|
||||||
|
)
|
||||||
|
self.assertEqual(len(pp_3_planned_orders), 2)
|
||||||
|
# PP-4
|
||||||
|
pp_4_line_1 = self.mrp_inventory_obj.search(
|
||||||
|
[("product_mrp_area_id.product_id", "=", self.pp_4.id)]
|
||||||
|
)
|
||||||
|
self.assertEqual(len(pp_4_line_1), 1)
|
||||||
|
self.assertEqual(pp_4_line_1.demand_qty, 30.0)
|
||||||
|
pp_4_planned_orders = self.planned_order_obj.search(
|
||||||
|
[("product_mrp_area_id.product_id", "=", self.pp_4.id)]
|
||||||
|
)
|
||||||
|
self.assertEqual(len(pp_4_planned_orders), 1)
|
||||||
|
|||||||
@@ -121,7 +121,15 @@ class MultiLevelMrp(models.TransientModel):
|
|||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def _prepare_mrp_move_data_bom_explosion(
|
def _prepare_mrp_move_data_bom_explosion(
|
||||||
self, product, bomline, qty, mrp_date_demand_2, bom, name, planned_order
|
self,
|
||||||
|
product,
|
||||||
|
bomline,
|
||||||
|
qty,
|
||||||
|
mrp_date_demand_2,
|
||||||
|
bom,
|
||||||
|
name,
|
||||||
|
planned_order,
|
||||||
|
values=None,
|
||||||
):
|
):
|
||||||
product_mrp_area = self._get_product_mrp_area_from_product_and_area(
|
product_mrp_area = self._get_product_mrp_area_from_product_and_area(
|
||||||
bomline.product_id, product.mrp_area_id
|
bomline.product_id, product.mrp_area_id
|
||||||
@@ -157,7 +165,7 @@ class MultiLevelMrp(models.TransientModel):
|
|||||||
).replace(
|
).replace(
|
||||||
"Demand Bom Explosion: Demand Bom Explosion: ", "Demand Bom Explosion: "
|
"Demand Bom Explosion: Demand Bom Explosion: ", "Demand Bom Explosion: "
|
||||||
),
|
),
|
||||||
"origin": planned_order.origin,
|
"origin": planned_order.origin if planned_order else values.get("origin"),
|
||||||
}
|
}
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
@@ -182,7 +190,9 @@ class MultiLevelMrp(models.TransientModel):
|
|||||||
return mrp_action_date, mrp_date_supply
|
return mrp_action_date, mrp_date_supply
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def explode_action(self, product_mrp_area_id, mrp_action_date, name, qty, action):
|
def explode_action(
|
||||||
|
self, product_mrp_area_id, mrp_action_date, name, qty, action, values=None
|
||||||
|
):
|
||||||
"""Explode requirements."""
|
"""Explode requirements."""
|
||||||
mrp_date_demand = mrp_action_date
|
mrp_date_demand = mrp_action_date
|
||||||
if mrp_date_demand < date.today():
|
if mrp_date_demand < date.today():
|
||||||
@@ -221,6 +231,7 @@ class MultiLevelMrp(models.TransientModel):
|
|||||||
bom,
|
bom,
|
||||||
name,
|
name,
|
||||||
action,
|
action,
|
||||||
|
values,
|
||||||
)
|
)
|
||||||
mrpmove_id2 = self.env["mrp.move"].create(move_data)
|
mrpmove_id2 = self.env["mrp.move"].create(move_data)
|
||||||
if hasattr(action, "mrp_move_down_ids"):
|
if hasattr(action, "mrp_move_down_ids"):
|
||||||
@@ -265,12 +276,20 @@ class MultiLevelMrp(models.TransientModel):
|
|||||||
order_data = self._prepare_planned_order_data(
|
order_data = self._prepare_planned_order_data(
|
||||||
product_mrp_area_id, qty, mrp_date_supply, mrp_action_date, name, values
|
product_mrp_area_id, qty, mrp_date_supply, mrp_action_date, name, values
|
||||||
)
|
)
|
||||||
|
# Do not create planned order for products that are Kits
|
||||||
|
planned_order = False
|
||||||
|
if not product_mrp_area_id.supply_method == "phantom":
|
||||||
planned_order = self.env["mrp.planned.order"].create(order_data)
|
planned_order = self.env["mrp.planned.order"].create(order_data)
|
||||||
qty_ordered = qty_ordered + qty
|
qty_ordered = qty_ordered + qty
|
||||||
|
|
||||||
if product_mrp_area_id._to_be_exploded():
|
if product_mrp_area_id._to_be_exploded():
|
||||||
self.explode_action(
|
self.explode_action(
|
||||||
product_mrp_area_id, mrp_action_date, name, qty, planned_order
|
product_mrp_area_id,
|
||||||
|
mrp_action_date,
|
||||||
|
name,
|
||||||
|
qty,
|
||||||
|
planned_order,
|
||||||
|
values,
|
||||||
)
|
)
|
||||||
|
|
||||||
values["qty_ordered"] = qty_ordered
|
values["qty_ordered"] = qty_ordered
|
||||||
@@ -768,8 +787,13 @@ class MultiLevelMrp(models.TransientModel):
|
|||||||
|
|
||||||
for product_mrp_area in product_mrp_area_ids:
|
for product_mrp_area in product_mrp_area_ids:
|
||||||
# Build the time-phased inventory
|
# Build the time-phased inventory
|
||||||
if self._exclude_from_mrp(
|
# Condition "supply_method == phantom" is not added in _exclude_from_mrp
|
||||||
|
# because this function is also used to filter the explosion.
|
||||||
|
if (
|
||||||
|
self._exclude_from_mrp(
|
||||||
product_mrp_area.product_id, product_mrp_area.mrp_area_id
|
product_mrp_area.product_id, product_mrp_area.mrp_area_id
|
||||||
|
)
|
||||||
|
or product_mrp_area.supply_method == "phantom"
|
||||||
):
|
):
|
||||||
continue
|
continue
|
||||||
self._init_mrp_inventory(product_mrp_area)
|
self._init_mrp_inventory(product_mrp_area)
|
||||||
|
|||||||
Reference in New Issue
Block a user