[FIX] sale_mrp: Issue in delivered quantity for sales order with kit items

Step to follow

Create a sale order for a kit with a quantity of one and Dozens as a unit of
measure
Confirm and validate the delivery
The delivered quantity will be 12 instead of 1

Cause of the issue

The delivered quantity wasn't recomputed in relation to the sales order
quantity

opw-2535193

closes odoo/odoo#75044

X-original-commit: 5ce39d13d1364df3d9c9638fce7f9d374f1c9b72
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
This commit is contained in:
Hubert Van de Walle (huvw)
2021-08-12 14:36:47 +00:00
parent aaf4424d73
commit 42f8e68e7a
+2 -1
View File
@@ -98,7 +98,8 @@ class SaleOrderLine(models.Model):
'outgoing_moves': lambda m: m.location_dest_id.usage != 'customer' and m.to_refund
}
order_qty = order_line.product_uom._compute_quantity(order_line.product_uom_qty, relevant_bom.product_uom_id)
order_line.qty_delivered = moves._compute_kit_quantities(order_line.product_id, order_qty, relevant_bom, filters)
qty_delivered = moves._compute_kit_quantities(order_line.product_id, order_qty, relevant_bom, filters)
order_line.qty_delivered = relevant_bom.product_uom_id._compute_quantity(qty_delivered, order_line.product_uom)
# If no relevant BOM is found, fall back on the all-or-nothing policy. This happens
# when the product sold is made only of kits. In this case, the BOM of the stock moves