mirror of
https://github.com/OCA/manufacture.git
synced 2025-01-28 16:37:15 +02:00
[IMP] mrp_bom_attribute_match: increase test strength: add another component to bom
This commit is contained in:
@@ -97,6 +97,10 @@ class TestMrpBomAttributeMatchBase(TransactionCase):
|
|||||||
component_template_id=cls.product_plastic.id,
|
component_template_id=cls.product_plastic.id,
|
||||||
product_qty=1,
|
product_qty=1,
|
||||||
),
|
),
|
||||||
|
dict(
|
||||||
|
product_id=cls.product_9,
|
||||||
|
product_qty=1,
|
||||||
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
cls.fin_bom_id = cls._create_bom(
|
cls.fin_bom_id = cls._create_bom(
|
||||||
|
|||||||
@@ -53,18 +53,18 @@ class TestMrpBomAttributeMatch(TestMrpBomAttributeMatchBase):
|
|||||||
plastic_smells_like_orchid.unlink()
|
plastic_smells_like_orchid.unlink()
|
||||||
|
|
||||||
def test_manufacturing_order_1(self):
|
def test_manufacturing_order_1(self):
|
||||||
|
sword_cyan = self.product_sword.product_variant_ids[0]
|
||||||
|
plastic_cyan = self.product_plastic.product_variant_ids[0]
|
||||||
mo_form = Form(self.env["mrp.production"])
|
mo_form = Form(self.env["mrp.production"])
|
||||||
mo_form.product_id = self.product_sword.product_variant_ids.filtered(
|
mo_form.product_id = sword_cyan
|
||||||
lambda x: x.display_name == "Plastic Sword (Cyan)"
|
|
||||||
)
|
|
||||||
mo_form.bom_id = self.bom_id
|
mo_form.bom_id = self.bom_id
|
||||||
mo_form.product_qty = 1
|
mo_form.product_qty = 1
|
||||||
self.mo_sword = mo_form.save()
|
self.mo_sword = mo_form.save()
|
||||||
self.mo_sword.action_confirm()
|
self.mo_sword.action_confirm()
|
||||||
# Assert correct component variant was selected automatically
|
# Assert correct component variant was selected automatically
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
self.mo_sword.move_raw_ids.product_id.display_name,
|
self.mo_sword.move_raw_ids.product_id,
|
||||||
"Plastic Component (Cyan)",
|
plastic_cyan + self.product_9,
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_manufacturing_order_2(self):
|
def test_manufacturing_order_2(self):
|
||||||
@@ -163,7 +163,11 @@ class TestMrpBomAttributeMatch(TestMrpBomAttributeMatchBase):
|
|||||||
self.assertEqual(res["lines"]["product"], sword_cyan)
|
self.assertEqual(res["lines"]["product"], sword_cyan)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
res["lines"]["components"][0]["line_id"],
|
res["lines"]["components"][0]["line_id"],
|
||||||
self.bom_id.bom_line_ids.id,
|
self.bom_id.bom_line_ids[0].id,
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
res["lines"]["components"][1]["line_id"],
|
||||||
|
self.bom_id.bom_line_ids[1].id,
|
||||||
)
|
)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
res["lines"]["components"][0]["parent_id"],
|
res["lines"]["components"][0]["parent_id"],
|
||||||
|
|||||||
Reference in New Issue
Block a user