From 6ec916bc740d976a0193eba250169f6c8b38cd13 Mon Sep 17 00:00:00 2001 From: Florent de Labarre Date: Mon, 21 Dec 2020 19:10:20 +0000 Subject: [PATCH] [FIX] sale_stock : widget wrong value closes odoo/odoo#63896 X-original-commit: 257cfeeda708cade0bd19b64eb8a95b3f61a063d Signed-off-by: Simon Goffin (sig) --- addons/sale_stock/models/sale_order.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/sale_stock/models/sale_order.py b/addons/sale_stock/models/sale_order.py index db97bab288d..3ead29edd4e 100644 --- a/addons/sale_stock/models/sale_order.py +++ b/addons/sale_stock/models/sale_order.py @@ -340,11 +340,13 @@ class SaleOrderLine(models.Model): line.free_qty_today = free_qty_today - qty_processed_per_product[line.product_id.id] line.virtual_available_at_date = virtual_available_at_date - qty_processed_per_product[line.product_id.id] line.forecast_expected_date = False + product_qty = line.product_uom_qty if line.product_uom and line.product_id.uom_id and line.product_uom != line.product_id.uom_id: line.qty_available_today = line.product_id.uom_id._compute_quantity(line.qty_available_today, line.product_uom) line.free_qty_today = line.product_id.uom_id._compute_quantity(line.free_qty_today, line.product_uom) line.virtual_available_at_date = line.product_id.uom_id._compute_quantity(line.virtual_available_at_date, line.product_uom) - qty_processed_per_product[line.product_id.id] += line.product_uom_qty + product_qty = line.product_uom._compute_quantity(product_qty, line.product_id.uom_id) + qty_processed_per_product[line.product_id.id] += product_qty treated |= lines remaining = (self - treated) remaining.virtual_available_at_date = False