[FIX] stock: qty in pack operations
- Enable lot tracking on Product A - UoM of Product A is kg, but Purchase UoM is lb(s) - Create a PO for 200 lb(s) of Product A, confirm - Go in the picking: 200.01 lb(s) shuold be received according to the pack operation, while 200.00 lb(s) are expected in the stock move. The field `product_qty` on the sotck move contains the quantity in kg, but already rounded from the value in lb(s). If we convert it back to lb(s), there might obviously be a rounding error, since we do: lb(s) -> kg -> lb(s) To solve this, we recompute the quantity in the UoM of the product without rounding, as a temporary computational value. opw-705259
This commit is contained in:
@@ -598,7 +598,10 @@ class Picking(models.Model):
|
||||
continue
|
||||
move_quants = move.reserved_quant_ids
|
||||
picking_quants += move_quants
|
||||
forced_qty = (move.state == 'assigned') and move.product_qty - sum([x.qty for x in move_quants]) or 0
|
||||
forced_qty = 0.0
|
||||
if move.state == 'assigned':
|
||||
qty = move.product_uom._compute_quantity(move.product_uom_qty, move.product_id.uom_id, round=False)
|
||||
forced_qty = qty - sum([x.qty for x in move_quants])
|
||||
# if we used force_assign() on the move, or if the move is incoming, forced_qty > 0
|
||||
if float_compare(forced_qty, 0, precision_rounding=move.product_id.uom_id.rounding) > 0:
|
||||
if forced_qties.get(move.product_id):
|
||||
|
||||
Reference in New Issue
Block a user