diff options
| author | William Henrotin <whe@odoo.com> | 2019-11-29 15:23:26 +0000 |
|---|---|---|
| committer | William Henrotin <whe@odoo.com> | 2019-11-29 15:23:26 +0000 |
| commit | 53252ed7bc44f7e43f6bdb0e6fcca731d5dc91c2 (patch) | |
| tree | cec2700171546af256a0e6ee73332bd81afaa1ad /addons/mrp/tests/test_workorder_operation.py | |
| parent | 9cee8c36f9fc78138f5a49efab1894ed5ca07f39 (diff) | |
[FIX] mrp_workorder: suggest total quantity by lot
Use case:
Plan a production of 10 units on 2 workorders. Produce 4 units of lot1.
Record the production and produce the 6 next ones with the same lot1. On
the second workorder, the suggested quantity is 4 and not 10.
This issue is due to the fact that we fill the next workorder quantity
only at the first production batch and we don't check that the same lot
can be used again.
This commit call the mathod to update the quantity on the next workorder
if the first lot is produced again.
closes odoo/odoo#41189
Opw: 2127665
X-original-commit: e15fc6ac994edabc8907c13295c883cff9320d10
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
Diffstat (limited to 'addons/mrp/tests/test_workorder_operation.py')
| -rw-r--r-- | addons/mrp/tests/test_workorder_operation.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/addons/mrp/tests/test_workorder_operation.py b/addons/mrp/tests/test_workorder_operation.py index 52b44901933..9e78963e8b4 100644 --- a/addons/mrp/tests/test_workorder_operation.py +++ b/addons/mrp/tests/test_workorder_operation.py @@ -1619,3 +1619,33 @@ class TestRoutingAndKits(SavepointCase): self.assertEqual(len(mo.workorder_ids), 2) self.assertEqual(set(mo.workorder_ids[0].raw_workorder_line_ids.product_id.ids), set([self.compfinished1.id, self.compkit1.id])) self.assertFalse(mo.workorder_ids[1].raw_workorder_line_ids.product_id.id) + + def test_merge_lot(self): + """ Produce 10 units of product tracked by lot on two workorder. On the + first one, produce 4 onto lot1 then 6 onto lot1 as well. The second + workorder should be prefilled with 10 units and lot1""" + self.finished1.tracking = 'lot' + lot1 = self.env['stock.production.lot'].create({ + 'product_id': self.finished1.id, + 'company_id': self.env.company.id, + }) + mo_form = Form(self.env['mrp.production']) + mo_form.product_id = self.finished1 + mo_form.bom_id = self.bom_finished1 + mo_form.product_qty = 10.0 + mo = mo_form.save() + + mo.action_confirm() + mo.button_plan() + wo1 = mo.workorder_ids.filtered(lambda wo: wo.state == 'ready')[0] + wo1.button_start() + wo1.qty_producing = 4 + wo1.finished_lot_id = lot1 + wo1.record_production() + wo1.qty_producing = 6 + wo1.finished_lot_id = lot1 + wo1.record_production() + wo2 = mo.workorder_ids.filtered(lambda wo: wo.state == 'ready')[0] + wo2.button_start() + self.assertEqual(wo2.qty_producing, 10) + self.assertEqual(wo2.finished_lot_id, lot1) |
