mirror of
https://github.com/OCA/manufacture.git
synced 2025-01-28 16:37:15 +02:00
[MIG] mrp_multi_level: Migration to 17.0
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
|
||||
{
|
||||
"name": "MRP Multi Level",
|
||||
"version": "16.0.1.3.5",
|
||||
"version": "17.0.1.0.0",
|
||||
"development_status": "Production/Stable",
|
||||
"license": "LGPL-3",
|
||||
"author": "Ucamco, ForgeFlow, Odoo Community Association (OCA)",
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
<field name="product_tmpl_id" ref="product_product_fp_1_product_template" />
|
||||
<field name="product_uom_id" ref="uom.product_uom_unit" />
|
||||
<field name="sequence">5</field>
|
||||
<field name="produce_delay">2</field>
|
||||
</record>
|
||||
<record id="mrp_bom_fp_1_line_pp_1" model="mrp.bom.line">
|
||||
<field name="product_id" ref="product_product_pp_1" />
|
||||
@@ -25,6 +26,7 @@
|
||||
<field name="product_tmpl_id" ref="product_product_fp_2_product_template" />
|
||||
<field name="product_uom_id" ref="uom.product_uom_unit" />
|
||||
<field name="sequence">5</field>
|
||||
<field name="produce_delay">1</field>
|
||||
</record>
|
||||
<record id="mrp_bom_fp_2_line_sf_1" model="mrp.bom.line">
|
||||
<field name="product_id" ref="product_product_sf_1" />
|
||||
@@ -42,10 +44,11 @@
|
||||
</record>
|
||||
|
||||
<!-- FP-3 -->
|
||||
<record id="mrp_bom_fp_3" model="mrp.bom">
|
||||
<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>
|
||||
<field name="produce_delay">3</field>
|
||||
</record>
|
||||
<record id="mrp_bom_fp_3_line_sf_3" model="mrp.bom.line">
|
||||
<field name="product_id" ref="product_product_sf_3" />
|
||||
@@ -62,8 +65,8 @@
|
||||
<field name="bom_id" ref="mrp_bom_fp_3" />
|
||||
</record>
|
||||
|
||||
<!-- Customizable Desk -->
|
||||
<record id="mrp_bom_product_4" model="mrp.bom">
|
||||
<!-- Customizable Desk -->
|
||||
<record id="mrp_bom_product_4" model="mrp.bom">
|
||||
<field
|
||||
name="product_tmpl_id"
|
||||
ref="product.product_product_4_product_template"
|
||||
@@ -120,6 +123,7 @@
|
||||
<field name="product_tmpl_id" ref="product_product_sf_1_product_template" />
|
||||
<field name="product_uom_id" ref="uom.product_uom_unit" />
|
||||
<field name="sequence">5</field>
|
||||
<field name="produce_delay">1</field>
|
||||
</record>
|
||||
<record id="mrp_bom_sf_1_line_pp_1" model="mrp.bom.line">
|
||||
<field name="product_id" ref="product_product_pp_1" />
|
||||
@@ -140,6 +144,7 @@
|
||||
<field name="product_tmpl_id" ref="product_product_sf_2_product_template" />
|
||||
<field name="product_uom_id" ref="uom.product_uom_unit" />
|
||||
<field name="sequence">5</field>
|
||||
<field name="produce_delay">3</field>
|
||||
</record>
|
||||
<record id="mrp_bom_sf_2_line_pp_2" model="mrp.bom.line">
|
||||
<field name="product_id" ref="product_product_pp_2" />
|
||||
@@ -149,11 +154,12 @@
|
||||
<field name="bom_id" ref="mrp_bom_sf_2" />
|
||||
</record>
|
||||
<!-- SF-3 -->
|
||||
<record id="mrp_bom_sf_3" model="mrp.bom">
|
||||
<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="type">phantom</field>
|
||||
<field name="sequence">5</field>
|
||||
<field name="produce_delay">3</field>
|
||||
</record>
|
||||
<record id="mrp_bom_sf_3_line_pp_3" model="mrp.bom.line">
|
||||
<field name="product_id" ref="product_product_pp_3" />
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
<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">2</field>
|
||||
<field
|
||||
name="route_ids"
|
||||
eval="[(6, 0, [ref('mrp.route_warehouse0_manufacture')])]"
|
||||
@@ -18,7 +17,6 @@
|
||||
<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">1</field>
|
||||
<field
|
||||
name="route_ids"
|
||||
eval="[(6, 0, [ref('mrp.route_warehouse0_manufacture')])]"
|
||||
@@ -30,7 +28,6 @@
|
||||
<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')])]"
|
||||
@@ -42,10 +39,9 @@
|
||||
<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">2</field>
|
||||
</record>
|
||||
|
||||
<!-- Customizable Desk -->
|
||||
<!-- Customizable Desk -->
|
||||
<record id="product.product_product_4_product_template" model="product.template">
|
||||
<field
|
||||
name="route_ids"
|
||||
@@ -58,7 +54,6 @@
|
||||
<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">1</field>
|
||||
<field
|
||||
name="route_ids"
|
||||
eval="[(6, 0, [ref('mrp.route_warehouse0_manufacture')])]"
|
||||
@@ -70,7 +65,6 @@
|
||||
<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')])]"
|
||||
@@ -82,7 +76,6 @@
|
||||
<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')])]"
|
||||
|
||||
@@ -92,3 +92,4 @@ class MrpMove(models.Model):
|
||||
stock_move_id = fields.Many2one(
|
||||
comodel_name="stock.move", string="Stock Move", index=True
|
||||
)
|
||||
bom_id = fields.Many2one("mrp.bom")
|
||||
|
||||
@@ -127,23 +127,18 @@ class ProductMRPArea(models.Model):
|
||||
if any(v < 0 for v in rec.values()):
|
||||
raise ValidationError(_("You cannot use a negative number."))
|
||||
|
||||
def name_get(self):
|
||||
return [
|
||||
(
|
||||
area.id,
|
||||
f"[{area.mrp_area_id.name}] {area.product_id.display_name}",
|
||||
def _compute_display_name(self):
|
||||
for area in self:
|
||||
area.display_name = (
|
||||
f"[{area.mrp_area_id.name}] {area.product_id.display_name}"
|
||||
)
|
||||
for area in self
|
||||
]
|
||||
|
||||
@api.model
|
||||
def _name_search(
|
||||
self, name, args=None, operator="ilike", limit=100, name_get_uid=None
|
||||
):
|
||||
def _name_search(self, name, domain=None, operator="ilike", limit=None, order=None):
|
||||
if operator in ("ilike", "like", "=", "=like", "=ilike"):
|
||||
args = expression.AND(
|
||||
domain = expression.AND(
|
||||
[
|
||||
args or [],
|
||||
domain or [],
|
||||
[
|
||||
"|",
|
||||
"|",
|
||||
@@ -153,9 +148,7 @@ class ProductMRPArea(models.Model):
|
||||
],
|
||||
]
|
||||
)
|
||||
return super(ProductMRPArea, self)._name_search(
|
||||
name, args=args, operator=operator, limit=limit, name_get_uid=name_get_uid
|
||||
)
|
||||
return super()._name_search(name, domain, operator, limit, order)
|
||||
|
||||
def _compute_mrp_lead_time(self):
|
||||
produced = self.filtered(lambda r: r.supply_method == "manufacture")
|
||||
@@ -164,7 +157,7 @@ class ProductMRPArea(models.Model):
|
||||
lambda r: r.supply_method in ("pull", "push", "pull_push")
|
||||
)
|
||||
for rec in produced:
|
||||
rec.mrp_lead_time = rec.product_id.produce_delay
|
||||
rec.mrp_lead_time = sum(rec.product_id.mapped("bom_ids.produce_delay"))
|
||||
for rec in purchased:
|
||||
rec.mrp_lead_time = rec.main_supplierinfo_id.delay
|
||||
for rec in distributed:
|
||||
@@ -220,7 +213,7 @@ class ProductMRPArea(models.Model):
|
||||
"""Simplified and similar to procurement.rule logic."""
|
||||
for rec in self.filtered(lambda r: r.supply_method == "buy"):
|
||||
suppliers = rec.product_id.seller_ids.filtered(
|
||||
lambda r: (not r.product_id or r.product_id == rec.product_id)
|
||||
lambda r, rec=rec: (not r.product_id or r.product_id == rec.product_id)
|
||||
and (not r.company_id or r.company_id == rec.company_id)
|
||||
).sorted(lambda s: (s.sequence, -s.min_qty, s.price, s.id))
|
||||
if not suppliers:
|
||||
|
||||
@@ -12,5 +12,5 @@ class StockQuant(models.Model):
|
||||
"""
|
||||
Adding field product_uom_id, inventory_quantity
|
||||
"""
|
||||
fields = super(StockQuant, self)._get_inventory_fields_write()
|
||||
fields = super()._get_inventory_fields_write()
|
||||
return fields + ["product_uom_id", "inventory_quantity"]
|
||||
|
||||
@@ -104,7 +104,6 @@ class TestMrpMultiLevelCommon(TransactionCase):
|
||||
"name": "Test Top Seller",
|
||||
"type": "product",
|
||||
"list_price": 150.0,
|
||||
"produce_delay": 5.0,
|
||||
"route_ids": [(6, 0, [route_buy])],
|
||||
"seller_ids": [(0, 0, {"partner_id": vendor1.id, "price": 20.0})],
|
||||
}
|
||||
@@ -214,7 +213,6 @@ class TestMrpMultiLevelCommon(TransactionCase):
|
||||
"uom_id": cls.env.ref("uom.product_uom_unit").id,
|
||||
"uom_po_id": cls.env.ref("uom.product_uom_dozen").id,
|
||||
"list_price": 150.0,
|
||||
"produce_delay": 5.0,
|
||||
"route_ids": [(6, 0, [route_buy])],
|
||||
"seller_ids": [(0, 0, {"partner_id": vendor1.id, "price": 20.0})],
|
||||
}
|
||||
@@ -230,7 +228,6 @@ class TestMrpMultiLevelCommon(TransactionCase):
|
||||
"tracking": "lot",
|
||||
"uom_id": cls.env.ref("uom.product_uom_unit").id,
|
||||
"list_price": 100.0,
|
||||
"produce_delay": 5.0,
|
||||
"route_ids": [(6, 0, [route_buy])],
|
||||
"seller_ids": [(0, 0, {"partner_id": vendor1.id, "price": 25.0})],
|
||||
}
|
||||
@@ -606,7 +603,7 @@ class TestMrpMultiLevelCommon(TransactionCase):
|
||||
mo_form.product_id = product
|
||||
mo_form.bom_id = bom
|
||||
mo_form.product_qty = qty
|
||||
mo_form.date_planned_start = date
|
||||
mo_form.date_start = date
|
||||
mo = mo_form.save()
|
||||
# Confirm the MO to generate stock moves:
|
||||
mo.action_confirm()
|
||||
|
||||
@@ -223,7 +223,7 @@ class TestMrpMultiLevel(TestMrpMultiLevelCommon):
|
||||
mos = self.mo_obj.search([("product_id", "=", self.fp_1.id)])
|
||||
self.assertTrue(mos)
|
||||
self.assertEqual(mos.product_qty, 100.0)
|
||||
mo_date_start = fields.Date.to_date(mos.date_planned_start)
|
||||
mo_date_start = fields.Date.to_date(mos.date_start)
|
||||
self.assertEqual(mo_date_start, self.date_5)
|
||||
|
||||
def test_07_adjust_qty_to_order(self):
|
||||
@@ -516,7 +516,7 @@ class TestMrpMultiLevel(TestMrpMultiLevelCommon):
|
||||
},
|
||||
]
|
||||
self.assertEqual(len(expected), len(inventory))
|
||||
for test_vals, inv in zip(expected, inventory):
|
||||
for test_vals, inv in zip(expected, inventory, strict=True):
|
||||
for key in test_vals:
|
||||
self.assertEqual(
|
||||
test_vals[key],
|
||||
@@ -606,7 +606,7 @@ class TestMrpMultiLevel(TestMrpMultiLevelCommon):
|
||||
},
|
||||
]
|
||||
self.assertEqual(len(expected), len(inventory))
|
||||
for test_vals, inv in zip(expected, inventory):
|
||||
for test_vals, inv in zip(expected, inventory, strict=True):
|
||||
for key in test_vals:
|
||||
self.assertEqual(
|
||||
test_vals[key],
|
||||
@@ -687,7 +687,7 @@ class TestMrpMultiLevel(TestMrpMultiLevelCommon):
|
||||
},
|
||||
]
|
||||
self.assertEqual(len(expected), len(inventory))
|
||||
for test_vals, inv in zip(expected, inventory):
|
||||
for test_vals, inv in zip(expected, inventory, strict=True):
|
||||
for key in test_vals:
|
||||
self.assertEqual(
|
||||
test_vals[key],
|
||||
@@ -759,7 +759,7 @@ class TestMrpMultiLevel(TestMrpMultiLevelCommon):
|
||||
},
|
||||
]
|
||||
self.assertEqual(len(expected), len(inventory))
|
||||
for test_vals, inv in zip(expected, inventory):
|
||||
for test_vals, inv in zip(expected, inventory, strict=True):
|
||||
for key in test_vals:
|
||||
self.assertEqual(
|
||||
test_vals[key],
|
||||
@@ -801,7 +801,7 @@ class TestMrpMultiLevel(TestMrpMultiLevelCommon):
|
||||
},
|
||||
]
|
||||
self.assertEqual(len(expected), len(inventory))
|
||||
for test_vals, inv in zip(expected, inventory):
|
||||
for test_vals, inv in zip(expected, inventory, strict=True):
|
||||
for key in test_vals:
|
||||
self.assertEqual(
|
||||
test_vals[key],
|
||||
@@ -844,7 +844,7 @@ class TestMrpMultiLevel(TestMrpMultiLevelCommon):
|
||||
},
|
||||
]
|
||||
self.assertEqual(len(expected), len(inventory))
|
||||
for test_vals, inv in zip(expected, inventory):
|
||||
for test_vals, inv in zip(expected, inventory, strict=True):
|
||||
for key in test_vals:
|
||||
self.assertEqual(
|
||||
test_vals[key],
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
name="web_ribbon"
|
||||
title="Archived"
|
||||
bg_color="bg-danger"
|
||||
attrs="{'invisible': [('active', '=', True)]}"
|
||||
invisible="active"
|
||||
/>
|
||||
<label for="name" class="oe_edit_only" />
|
||||
<h1>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<field name="supply_method" />
|
||||
<field
|
||||
name="main_supplier_id"
|
||||
attrs="{'invisible': [('supply_method', '!=', 'buy')]}"
|
||||
invisible="supply_method != 'buy'"
|
||||
/>
|
||||
<field name="date" />
|
||||
</group>
|
||||
@@ -53,7 +53,7 @@
|
||||
<field name="final_on_hand_qty" />
|
||||
<field name="to_procure" />
|
||||
<button
|
||||
attrs="{'invisible': [('planned_order_ids', '=', [])]}"
|
||||
invisible="not planned_order_ids"
|
||||
name="action_open_planned_orders"
|
||||
type="object"
|
||||
icon="fa-list"
|
||||
@@ -65,9 +65,9 @@
|
||||
name="%(mrp_multi_level.act_mrp_inventory_procure)d"
|
||||
icon="fa-cogs"
|
||||
type="action"
|
||||
attrs="{'invisible':[('to_procure','<=',0.0)]}"
|
||||
invisible="to_procure <= 0.0"
|
||||
/>
|
||||
<field name="planned_order_ids" invisible="1" />
|
||||
<field name="planned_order_ids" column_invisible="True" />
|
||||
<field name="supply_method" />
|
||||
<field name="main_supplier_id" optional="hide" />
|
||||
<field name="running_availability" />
|
||||
|
||||
@@ -39,40 +39,34 @@
|
||||
<field name="mrp_origin" />
|
||||
<field
|
||||
name="production_id"
|
||||
attrs="{'invisible':[('mrp_origin', '!=', 'mo')]}"
|
||||
invisible="mrp_origin != 'mo'"
|
||||
/>
|
||||
<field
|
||||
name="purchase_order_id"
|
||||
attrs="{'invisible':[('mrp_origin', '!=', 'po')]}"
|
||||
invisible="mrp_origin != 'po'"
|
||||
/>
|
||||
<field
|
||||
name="purchase_line_id"
|
||||
attrs="{'invisible':[('mrp_origin', '!=', 'po')]}"
|
||||
invisible="mrp_origin != 'po'"
|
||||
/>
|
||||
<field
|
||||
name="stock_move_id"
|
||||
attrs="{'invisible':[('mrp_origin', '!=', 'mv')]}"
|
||||
invisible="mrp_origin != 'mv'"
|
||||
/>
|
||||
<field name="name" />
|
||||
<field name="origin" />
|
||||
</group>
|
||||
<group>
|
||||
<field name="mrp_date" />
|
||||
<field
|
||||
name="current_date"
|
||||
attrs="{'invisible': [('current_date', '=', False)]}"
|
||||
/>
|
||||
<field
|
||||
name="state"
|
||||
attrs="{'invisible': [('state', '=', False)]}"
|
||||
/>
|
||||
<field name="current_date" invisible="not current_date" />
|
||||
<field name="state" invisible="not state" />
|
||||
<field
|
||||
name="mrp_order_number"
|
||||
attrs="{'invisible': [('mrp_order_number', '=', False)]}"
|
||||
invisible="not mrp_order_number"
|
||||
/>
|
||||
<field
|
||||
name="parent_product_id"
|
||||
attrs="{'invisible': [('parent_product_id', '=', False)]}"
|
||||
invisible="not parent_product_id"
|
||||
/>
|
||||
<field name="mrp_qty" />
|
||||
<field name="current_qty" />
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
name="action_open_linked_mrp_production"
|
||||
type="object"
|
||||
icon="fa-wrench"
|
||||
attrs="{'invisible':[('mo_count', '=', 0)]}"
|
||||
invisible="mo_count == 0"
|
||||
class="oe_stat_button"
|
||||
>
|
||||
<field name="mo_count" widget="statinfo" string="MOs" />
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
name="web_ribbon"
|
||||
title="Archived"
|
||||
bg_color="bg-danger"
|
||||
attrs="{'invisible': [('active', '=', True)]}"
|
||||
invisible="active"
|
||||
/>
|
||||
<group colspan="4" col="2">
|
||||
<group>
|
||||
@@ -86,7 +86,7 @@
|
||||
string="Get from main supplier"
|
||||
type="object"
|
||||
name="update_min_qty_from_main_supplier"
|
||||
attrs="{'invisible':[('supply_method', '!=', 'buy'), ('main_supplierinfo_id', '=', False)]}"
|
||||
invisible="supply_method != 'buy' and not main_supplierinfo_id"
|
||||
class="oe_link pt-0 oe_inline"
|
||||
/>
|
||||
</span>
|
||||
@@ -96,12 +96,12 @@
|
||||
<field name="supply_method" />
|
||||
<field
|
||||
name="distribution_lead_time"
|
||||
attrs="{'invisible': [('supply_method', 'not in', ('pull', 'push', 'pull_push'))]}"
|
||||
invisible="supply_method not in ('pull', 'push', 'pull_push')"
|
||||
/>
|
||||
<field name="mrp_lead_time" />
|
||||
<field
|
||||
name="main_supplierinfo_id"
|
||||
attrs="{'invisible':[('supply_method', '!=', 'buy')]}"
|
||||
invisible="supply_method != 'buy'"
|
||||
/>
|
||||
</group>
|
||||
</group>
|
||||
|
||||
@@ -40,13 +40,13 @@ class MrpInventoryProcure(models.TransientModel):
|
||||
view_id = self.env.ref(
|
||||
"mrp_multi_level.view_mrp_inventory_procure_without_security"
|
||||
).id
|
||||
return super(MrpInventoryProcure, self).fields_view_get(
|
||||
return super().fields_view_get(
|
||||
view_id=view_id, view_type=view_type, toolbar=toolbar, submenu=submenu
|
||||
)
|
||||
|
||||
@api.model
|
||||
def default_get(self, fields):
|
||||
res = super(MrpInventoryProcure, self).default_get(fields)
|
||||
res = super().default_get(fields)
|
||||
active_ids = self.env.context["active_ids"] or []
|
||||
active_model = self.env.context["active_model"]
|
||||
if not active_ids or "item_ids" not in fields:
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<group name="items" string="Items" />
|
||||
<field name="item_ids" nolabel="1">
|
||||
<tree nocreate="1" editable="top">
|
||||
<field name="mrp_inventory_id" invisible="True" />
|
||||
<field name="mrp_inventory_id" column_invisible="True" />
|
||||
<field
|
||||
name="warehouse_id"
|
||||
groups="stock.group_stock_multi_locations"
|
||||
|
||||
@@ -153,6 +153,7 @@ class MultiLevelMrp(models.TransientModel):
|
||||
"Demand Bom Explosion: Demand Bom Explosion: ", "Demand Bom Explosion: "
|
||||
),
|
||||
"origin": planned_order.origin if planned_order else values.get("origin"),
|
||||
"bom_id": bom.id,
|
||||
}
|
||||
|
||||
@api.model
|
||||
@@ -382,7 +383,7 @@ class MultiLevelMrp(models.TransientModel):
|
||||
count_domain = [("mrp_applicable", "=", True)]
|
||||
if mrp_areas:
|
||||
count_domain += [("mrp_area_id", "in", mrp_areas.ids)]
|
||||
counter = self.env["product.mrp.area"].search(count_domain, count=True)
|
||||
counter = self.env["product.mrp.area"].search_count(count_domain)
|
||||
log_msg = "End Calculate MRP Applicable: %s" % counter
|
||||
logger.info(log_msg)
|
||||
return True
|
||||
@@ -507,7 +508,7 @@ class MultiLevelMrp(models.TransientModel):
|
||||
init_counter = 0
|
||||
for mrp_area in mrp_areas:
|
||||
for product_mrp_area in product_mrp_areas.filtered(
|
||||
lambda a: a.mrp_area_id == mrp_area
|
||||
lambda a, mrp_area=mrp_area: a.mrp_area_id == mrp_area
|
||||
):
|
||||
if self._exclude_from_mrp(product_mrp_area.product_id, mrp_area):
|
||||
continue
|
||||
@@ -865,7 +866,7 @@ class MultiLevelMrp(models.TransientModel):
|
||||
)
|
||||
# attach planned orders to inventory
|
||||
for po in planned_orders:
|
||||
invs = mrp_invs.filtered(lambda i: i.date == po.due_date)
|
||||
invs = mrp_invs.filtered(lambda i, po=po: i.date == po.due_date)
|
||||
if invs:
|
||||
po.mrp_inventory_id = invs[0]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user