[IMP] mrp_bom_attribute_match: increase test strength: add another component to bom

This commit is contained in:
Ivàn Todorovich
2023-01-31 14:06:04 -03:00
committed by Ilyas
parent 8054deee56
commit 522fa98d29
2 changed files with 14 additions and 6 deletions

View File

@@ -97,6 +97,10 @@ class TestMrpBomAttributeMatchBase(TransactionCase):
component_template_id=cls.product_plastic.id,
product_qty=1,
),
dict(
product_id=cls.product_9,
product_qty=1,
),
],
)
cls.fin_bom_id = cls._create_bom(

View File

@@ -53,18 +53,18 @@ class TestMrpBomAttributeMatch(TestMrpBomAttributeMatchBase):
plastic_smells_like_orchid.unlink()
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.product_id = self.product_sword.product_variant_ids.filtered(
lambda x: x.display_name == "Plastic Sword (Cyan)"
)
mo_form.product_id = sword_cyan
mo_form.bom_id = self.bom_id
mo_form.product_qty = 1
self.mo_sword = mo_form.save()
self.mo_sword.action_confirm()
# Assert correct component variant was selected automatically
self.assertEqual(
self.mo_sword.move_raw_ids.product_id.display_name,
"Plastic Component (Cyan)",
self.mo_sword.move_raw_ids.product_id,
plastic_cyan + self.product_9,
)
def test_manufacturing_order_2(self):
@@ -163,7 +163,11 @@ class TestMrpBomAttributeMatch(TestMrpBomAttributeMatchBase):
self.assertEqual(res["lines"]["product"], sword_cyan)
self.assertEqual(
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(
res["lines"]["components"][0]["parent_id"],