[FIX] resolve codepatch fails issue

This commit is contained in:
Urvisha-OSI
2023-04-04 18:03:19 +05:30
parent b374a5d08f
commit 1af148fa44

View File

@@ -18,6 +18,7 @@ class TestBomTracking(TransactionCase):
cls.product_1 = cls.product_obj.create({"name": "TEST 01", "type": "product"})
cls.component_1 = cls.product_obj.create({"name": "RM 01", "type": "product"})
cls.component_2 = cls.product_obj.create({"name": "RM 02", "type": "product"})
# cls.uom_1 = cls.env['uom.uom'].create({"name": "RM UOM", "category_id": 1})
cls.component_2_alt = cls.product_obj.create(
{"name": "RM 02-B", "type": "product"}
)
@@ -33,14 +34,26 @@ class TestBomTracking(TransactionCase):
{"product_id": cls.component_2.id, "bom_id": cls.bom.id, "product_qty": 5.0}
)
def test_01_change_bom_lines(self):
self.component_3 = self.product_obj.create({"name": "RM 03", "type": "product"})
bom_line_ids = self.bom_line_obj.create(
{
"product_id": self.component_3.id,
"product_qty": 2.0,
"bom_id": self.bom.id,
}
)
self.bom.write({"bom_line_ids": [(6, 0, bom_line_ids.ids)]})
def test_01_change_bom_line_qty(self):
before = self.bom.message_ids
self.line_1.product_qty = 3.0
self.line_2.write({"product_qty": 3.0})
after = self.bom.message_ids
self.assertEqual(len(after - before), 1)
def test_02_change_bom_line_product(self):
before = self.bom.message_ids
self.line_2.product_id = self.component_2_alt
self.line_2.write({"product_id": self.component_2_alt.id})
after = self.bom.message_ids
self.assertEqual(len(after - before), 1)
self.line_2.write({"product_uom_id": 2})