[FIX] mrp: test_product_produce_3

Test was relying on qty_to_consume getting saved when the produce form
is saved, a behaviour of the SSF which diverged from the actual
client.

After fixing the SSF to behave more in-line with the actual
client (don't save o2m sub-fields unless they're flagged as
force_save) the test is now visibly broken.

Fix it so qty_done is properly updated during wizard configuration /
edition instead of updating the in-database object directly.

closes odoo/odoo#32047

Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
This commit is contained in:
Xavier Morel
2019-04-03 09:42:04 +00:00
parent ef8df8fb4e
commit 2430e28e83
+3 -2
View File
@@ -561,6 +561,9 @@ class TestMrpOrder(TestMrpCommon):
'active_ids': [mo.id],
}))
produce_form.product_qty = 1.0
for i in range(len(produce_form.produce_line_ids)):
with produce_form.produce_line_ids.edit(i) as line:
line.qty_done += 1
product_produce = produce_form.save()
product_produce.lot_id = final_product_lot.id
# product 1 lot 1 shelf1
@@ -568,8 +571,6 @@ class TestMrpOrder(TestMrpCommon):
# product 1 lot 2
self.assertEqual(len(product_produce.produce_line_ids), 4, 'You should have 4 produce lines. lot 1 shelf_1, lot 1 shelf_2, lot2 and for product which have tracking None')
for produce_line in product_produce.produce_line_ids:
produce_line.qty_done = produce_line.qty_to_consume + 1
product_produce.do_produce()
move_1 = mo.move_raw_ids.filtered(lambda m: m.product_id == p1)