Fix corruption of outgoing_moves in packed state of stock.shipment.out
The `move_obj.write` changes the value of `quantity` in the move, but the removed_qty computation used `move.quantity` from the browse record. The browse record gets the updated value and not the old value from browse_record cache. This fix just moves the computation before the move_obj.write and includes a scenario to confirm the behavior. issue2426 review254001 (transplanted from eedeb7ba47b1363919364b40a07862ccf012db97)
This commit is contained in:
1 parent
90a0929cdd
commit
4c26686ad8
4 files changed
+220
-3
No files matched your search
+3
-3
@@ -1018,12 +1018,12 @@ class ShipmentOut(ModelWorkflow, ModelSQL, ModelView):
|
||||
if outgoing_qty.get(move.product.id, 0.0) > 0.0:
|
||||
exc_qty = uom_obj.compute_qty(move.product.default_uom,
|
||||
outgoing_qty[move.product.id], move.uom)
|
||||
move_obj.write(move.id,{
|
||||
'quantity': max(0.0, move.quantity-exc_qty),
|
||||
})
|
||||
removed_qty = uom_obj.compute_qty(move.uom,
|
||||
min(exc_qty, move.quantity), move.product.default_uom,
|
||||
round=False)
|
||||
move_obj.write(move.id,{
|
||||
'quantity': max(0.0, move.quantity-exc_qty),
|
||||
})
|
||||
outgoing_qty[move.product.id] -= removed_qty
|
||||
|
||||
move_obj.write([x.id for x in shipment.outgoing_moves
|
||||
|
||||
Reference in new issue
Block a user