mirror of
https://github.com/OCA/manufacture.git
synced 2025-01-28 16:37:15 +02:00
[IMP] mrp_bom_attribute_match: tests
This commit is contained in:
@@ -81,7 +81,42 @@ class TestMrpBomAttributeMatchNested(TestMrpBomAttributeMatchBase):
|
||||
)
|
||||
|
||||
def test_nested(self):
|
||||
self.env["mrp.routing.workcenter"].create(
|
||||
[
|
||||
{
|
||||
"name": "Operation 1",
|
||||
"workcenter_id": self.env.ref("mrp.mrp_workcenter_1").id,
|
||||
"bom_id": self.bom_top.id,
|
||||
},
|
||||
{
|
||||
"name": "Operation 2",
|
||||
"workcenter_id": self.env.ref("mrp.mrp_workcenter_2").id,
|
||||
"bom_id": self.bom_top.id,
|
||||
},
|
||||
{
|
||||
"name": "Operation 1",
|
||||
"workcenter_id": self.env.ref("mrp.mrp_workcenter_1").id,
|
||||
"bom_id": self.bom_sub.id,
|
||||
},
|
||||
{
|
||||
"name": "Operation 2",
|
||||
"workcenter_id": self.env.ref("mrp.mrp_workcenter_2").id,
|
||||
"bom_id": self.bom_sub.id,
|
||||
},
|
||||
]
|
||||
)
|
||||
BomStructureReport = self.env["report.mrp.report_bom_structure"]
|
||||
|
||||
values_top = BomStructureReport._get_report_values(
|
||||
self.bom_top.ids,
|
||||
data={"variant": self.bom_top.product_tmpl_id.product_variant_id.id},
|
||||
)
|
||||
values_sub = BomStructureReport._get_report_values(
|
||||
self.bom_sub.ids,
|
||||
data={"variant": self.bom_sub.product_tmpl_id.product_variant_id.id},
|
||||
)
|
||||
self.assertIn("Sub Sub 1", str(values_top["docs"][0]["lines"]))
|
||||
self.assertIn("Sub-Level", str(values_top["docs"][0]["lines"]))
|
||||
self.assertIn("Sub Sub 1", str(values_sub["docs"][0]["lines"]))
|
||||
self.assertNotIn("Sub-Level", str(values_sub["docs"][0]["lines"]))
|
||||
BomStructureReport._get_report_data(self.bom_sub.id)
|
||||
BomStructureReport._get_report_data(self.bom_top.id)
|
||||
|
||||
Reference in New Issue
Block a user