diff options
| author | fw-bot <otis@odoo.com> | 2020-07-16 10:57:17 +0000 |
|---|---|---|
| committer | William Henrotin <whe@odoo.com> | 2020-07-16 13:39:30 +0000 |
| commit | 679a746b78ba4426a3beb4b8cda65d80806b92c2 (patch) | |
| tree | 79cace5c38610ab0b326f4755e212443094dea6e /addons/mrp/tests/test_order.py | |
| parent | eedbcfbef54ac51caf8b732ce5fad71aa30b4cd8 (diff) | |
[FIX] mrp: avoid consumption check for null additional components
Adding additional product to a production but consuming 0 on it will
trigger the consumption warning wizard while no difference with the bom
are occurring. This commit do not trigger the consumption issue in that
case.
Task : 2278147
closes odoo/odoo#54561
Related: odoo/enterprise#11885
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
Diffstat (limited to 'addons/mrp/tests/test_order.py')
| -rw-r--r-- | addons/mrp/tests/test_order.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/addons/mrp/tests/test_order.py b/addons/mrp/tests/test_order.py index bae3b44428f..341afe9d379 100644 --- a/addons/mrp/tests/test_order.py +++ b/addons/mrp/tests/test_order.py @@ -634,6 +634,38 @@ class TestMrpOrder(TestMrpCommon): mo.button_mark_done() self.assertEqual(mo.state, 'done') + def test_consumption_flexible_2(self): + """ Checks the constraints of a strict BOM only apply to the product of the BoM. """ + self.stock_location = self.env.ref('stock.stock_location_stock') + mo, bom, p_final, p1, p2 = self.generate_mo(consumption='flexible', qty_final=1) + self.assertEqual(len(mo), 1, 'MO should have been created') + + self.env['stock.quant']._update_available_quantity(p1, self.stock_location, 100) + self.env['stock.quant']._update_available_quantity(p2, self.stock_location, 5) + add_product = self.env['product.product'].create({ + 'name': 'additional', + 'type': 'product', + }) + mo.action_assign() + + mo_form = Form(mo) + + # try adding another line for a bom product to increase the quantity + mo_form.qty_producing = 1 + with mo_form.move_raw_ids.new() as line: + line.product_id = p1 + with mo_form.move_raw_ids.new() as line: + line.product_id = add_product + mo = mo_form.save() + details_operation_form = Form(mo.move_raw_ids[-1], view=self.env.ref('stock.view_stock_move_operations')) + with details_operation_form.move_line_ids.new() as ml: + ml.qty_done = 1 + details_operation_form.save() + + # Won't accept to be done, instead return a wizard + mo.button_mark_done() + self.assertEqual(mo.state, 'done') + def test_product_produce_9(self): """ Checks the production wizard contains lines even for untracked products. """ serial = self.env['product.product'].create({ |
