diff --git a/addons/mrp/tests/test_bom.py b/addons/mrp/tests/test_bom.py index a2a21ae73e2..0031eb4e494 100644 --- a/addons/mrp/tests/test_bom.py +++ b/addons/mrp/tests/test_bom.py @@ -131,8 +131,30 @@ class TestBoM(TestMrpCommon): self.assertEqual(set((test_bom_2 | self.bom_2).ids), set([b[0].id for b in boms])) self.assertEqual(set((test_bom_2_l1 | test_bom_2_l4 | self.bom_2.bom_line_ids).ids), set([l[0].id for l in lines])) - # check recursion - test_bom_2_l3.write({'attribute_value_ids': [(6, 0, [self.prod_attr1_v1.id])]}) - #wrong test - # with self.assertRaises(exceptions.UserError): - # test_bom_2.explode(self.product_7_1, 4) + #check recursion + test_bom_3 = self.env['mrp.bom'].create({ + 'product_id': self.product_2.id, + 'product_tmpl_id': self.product_2.product_tmpl_id.id, + 'product_uom_id': self.product_2.uom_id.id, + 'product_qty': 1.0, + 'type': 'normal' + }) + test_bom_4 = self.env['mrp.bom'].create({ + 'product_id': self.product_4.id, + 'product_tmpl_id': self.product_4.product_tmpl_id.id, + 'product_uom_id': self.product_4.uom_id.id, + 'product_qty': 1.0, + 'type': 'phantom' + }) + test_bom_3_l1 = self.env['mrp.bom.line'].create({ + 'bom_id': test_bom_3.id, + 'product_id': self.product_4.id, + 'product_qty': 1.0, + }) + test_bom_4_l1 = self.env['mrp.bom.line'].create({ + 'bom_id': test_bom_4.id, + 'product_id': self.product_2.id, + 'product_qty': 1.0, + }) + with self.assertRaises(exceptions.UserError): + test_bom_3.explode(self.product_2, 1)