[FIX] stock: UoM on return lot

- Create a product with:
  Product UoM: kg
  Purchase UoM: lb(s)
  Tracking: By lot(s)
- Purchase 100 lb(s), validate and receive picking (set lot 001)
- Return the picking
- Set the lot

The quantity to do is 45.36 instead of 100.

We make sure to convert the quant UoM (=Product UoM) into the
appropriate UoM.

opw-771930
This commit is contained in:
Nicolas Martinelli
2017-09-20 10:15:23 +02:00
committed by Goffin Simon
parent 6252c21000
commit dfe96ff38e
+5 -2
View File
@@ -572,8 +572,11 @@ class Picking(models.Model):
'location_dest_id': mapping.location_dst_id,
'product_uom_id': uom.id,
'pack_lot_ids': [
(0, 0, {'lot_id': lot, 'qty': 0.0, 'qty_todo': lots_grouped[mapping][lot]})
for lot in lots_grouped.get(mapping, {}).keys()],
(0, 0, {
'lot_id': lot,
'qty': 0.0,
'qty_todo': mapping.product.uom_id._compute_quantity(lots_grouped[mapping][lot], uom)
}) for lot in lots_grouped.get(mapping, {}).keys()],
}
product_id_to_vals.setdefault(mapping.product.id, list()).append(val_dict)