summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorArnold Moyaux <arm@odoo.com>2019-07-17 12:13:30 +0000
committerArnold Moyaux <arm@odoo.com>2019-08-19 14:14:13 +0000
commit44507c039e2b8703f74bf9bd16b9202adca4387a (patch)
tree994dde64e0ee44cda23773c85189b9edf716c010 /addons
parent876c7522fc850b5b35c66c1293847cfbb9b31141 (diff)
[FIX] mrp: change production quantity is wrong on finished moves
Usecase to reproduce: - BoM -> 1 component for 1 final product - Create a MO with a quanity of 5 - Update the quantity to 6 -> The move finished has an initial demand of 4
Diffstat (limited to 'addons')
-rw-r--r--addons/mrp/tests/test_order.py1
-rw-r--r--addons/mrp/wizard/change_production_qty.py4
2 files changed, 3 insertions, 2 deletions
diff --git a/addons/mrp/tests/test_order.py b/addons/mrp/tests/test_order.py
index 2ad70c21f4e..d21e246215e 100644
--- a/addons/mrp/tests/test_order.py
+++ b/addons/mrp/tests/test_order.py
@@ -516,6 +516,7 @@ class TestMrpOrder(TestMrpCommon):
update_quantity_wizard.change_prod_qty()
self.assertEqual(mo.move_raw_ids.filtered(lambda m: m.product_id == p1).quantity_done, 20, 'Update the produce quantity should not impact already produced quantity.')
+ self.assertEqual(mo.move_finished_ids.product_uom_qty, 4)
mo.button_mark_done()
def test_product_produce_6(self):
diff --git a/addons/mrp/wizard/change_production_qty.py b/addons/mrp/wizard/change_production_qty.py
index 56bba899044..f0ab200582a 100644
--- a/addons/mrp/wizard/change_production_qty.py
+++ b/addons/mrp/wizard/change_production_qty.py
@@ -35,8 +35,8 @@ class ChangeProductionQty(models.TransientModel):
modification = {}
for move in production.move_finished_ids.filtered(lambda m: m.state not in ('done', 'cancel')):
qty = (qty - old_qty) * move.unit_factor
- modification[move] = (move.product_uom_qty - qty, move.product_uom_qty)
- move[0].write({'product_uom_qty': move.product_uom_qty - qty})
+ modification[move] = (move.product_uom_qty + qty, move.product_uom_qty)
+ move[0].write({'product_uom_qty': move.product_uom_qty + qty})
return modification
def change_prod_qty(self):