summaryrefslogtreecommitdiff
path: root/addons/mrp/tests/test_order.py
diff options
context:
space:
mode:
authorWilliam Henrotin <whe@odoo.com>2020-07-27 09:14:30 +0000
committerWilliam Henrotin <whe@odoo.com>2020-08-10 09:40:24 +0000
commit68f06c7accbc903981bbaa47fdc8024bb7229f11 (patch)
tree23dbe765b51a2b3c10592b7f8490909ad6899d28 /addons/mrp/tests/test_order.py
parent57f243bcbbc162c8a0db9b3ef0135b2b7aec4a92 (diff)
[FIX] mrp: copying production order copy all moves
Before this commit, only the moves raw were copied on production duplication. As the finished move is created normally in an onchange, this means a production order duplicated have not any move finished. Task : 2278147
Diffstat (limited to 'addons/mrp/tests/test_order.py')
-rw-r--r--addons/mrp/tests/test_order.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/addons/mrp/tests/test_order.py b/addons/mrp/tests/test_order.py
index 0b815e2e9f9..cd7015a90ce 100644
--- a/addons/mrp/tests/test_order.py
+++ b/addons/mrp/tests/test_order.py
@@ -1312,3 +1312,22 @@ class TestMrpOrder(TestMrpCommon):
self.assertEqual(mo.move_finished_ids.state, 'done')
self.assertEqual(mo.move_finished_ids.quantity_done, 1)
self.assertEqual(component.qty_available, 13)
+
+ def test_copy(self):
+ """ Check that copying a done production, create all the stock moves"""
+ mo, bom, p_final, p1, p2 = self.generate_mo(qty_final=1, qty_base_1=1, qty_base_2=1)
+ mo.action_confirm()
+ mo_form = Form(mo)
+ mo_form.qty_producing = 1
+ mo = mo_form.save()
+ mo.button_mark_done()
+ self.assertEqual(mo.state, 'done')
+ mo_copy = mo.copy()
+ self.assertTrue(mo_copy.move_raw_ids)
+ self.assertTrue(mo_copy.move_finished_ids)
+ mo_copy.action_confirm()
+ mo_form = Form(mo_copy)
+ mo_form.qty_producing = 1
+ mo_copy = mo_form.save()
+ mo_copy.button_mark_done()
+ self.assertEqual(mo_copy.state, 'done')