From 2430e28e837f01f27d2a59c8d2649a4bbadcc757 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Tue, 2 Apr 2019 07:08:20 +0000 Subject: [PATCH] [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) --- addons/mrp/tests/test_order.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/mrp/tests/test_order.py b/addons/mrp/tests/test_order.py index 6c7c7db4962..61538b5ecab 100644 --- a/addons/mrp/tests/test_order.py +++ b/addons/mrp/tests/test_order.py @@ -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)