[FIX] stock: UoM in qty check
- 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, specify the lots. - Validate, and error: 'You have a difference between the quantity...' This is because `lot_quantities` contains the quantities in kg, while `operation.product_qty` is in lb(s). opw-705259
This commit is contained in:
@@ -797,7 +797,11 @@ class StockMove(models.Model):
|
||||
# compute quantities for each lot + check quantities match
|
||||
lot_quantities = dict((pack_lot.lot_id.id, operation.product_uom_id._compute_quantity(pack_lot.qty, operation.product_id.uom_id)
|
||||
) for pack_lot in operation.pack_lot_ids)
|
||||
if operation.pack_lot_ids and float_compare(sum(lot_quantities.values()), operation.product_qty, precision_rounding=operation.product_uom_id.rounding) != 0.0:
|
||||
|
||||
qty = operation.product_qty
|
||||
if operation.product_uom_id and operation.product_uom_id != operation.product_id.uom_id:
|
||||
qty = operation.product_uom_id._compute_quantity(qty, operation.product_id.uom_id)
|
||||
if operation.pack_lot_ids and float_compare(sum(lot_quantities.values()), qty, precision_rounding=operation.product_id.uom_id.rounding) != 0.0:
|
||||
raise UserError(_('You have a difference between the quantity on the operation and the quantities specified for the lots. '))
|
||||
|
||||
quants_taken = []
|
||||
|
||||
Reference in New Issue
Block a user