[FIX] purchase_stock: deliver qui with different UoM

- Create a product A with UoM set to 'Units(s)'
- Create a product B with UoM set to 'Liter(s)'
- Create a BOM of type kit, 2 Liters of B to create 1 Unit of A
- Create a PO with A, validate
- Validate the corresponding picking

An error is raised since we try to compute the quantity received in
Units based on a quantity in Liters.

In case of a kit BOM, an override exists in `purchase_mrp` to compute
correctly the quantity. Therefore, we can skip the line.

Corresponding fix for SO: 47959438b6

Closes #45871
opw-2205970

closes odoo/odoo#46748

X-original-commit: 2ad4621c03a1885f2bb210960ebe8b5ae277e439
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
Nicolas Martinelli
2020-03-03 13:05:32 +00:00
parent 071b00f6a1
commit ed3f448e68
+3 -1
View File
@@ -255,7 +255,9 @@ class PurchaseOrderLine(models.Model):
for line in self:
if line.qty_received_method == 'stock_moves':
total = 0.0
for move in line.move_ids:
# In case of a BOM in kit, the products delivered do not correspond to the products in
# the PO. Therefore, we can skip them since they will be handled later on.
for move in line.move_ids.filtered(lambda m: m.product_id == line.product_id):
if move.state == 'done':
if move.location_dest_id.usage == "supplier":
if move.to_refund: