[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
This commit is contained in:
@@ -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):
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user