From cccb29871b617cd98625045748203ebbd450fbfd Mon Sep 17 00:00:00 2001 From: matiasperalta1 Date: Tue, 6 Sep 2022 16:33:29 +0000 Subject: [PATCH] [FIX] sale_stock_ux: reserved quantity widget closes ingadhoc/sale#570 Signed-off-by: Nicolas Mac Rouillon --- sale_stock_ux/models/sale_order_line.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sale_stock_ux/models/sale_order_line.py b/sale_stock_ux/models/sale_order_line.py index 1b9ef1b5c..7819a5af5 100644 --- a/sale_stock_ux/models/sale_order_line.py +++ b/sale_stock_ux/models/sale_order_line.py @@ -42,7 +42,7 @@ class SaleOrderLine(models.Model): def _compute_total_reserved_quantity(self): for line in self: loc_id = line.order_id.warehouse_id.lot_stock_id.id - stock_quants = line.product_id.stock_quant_ids.filtered(lambda x: x.location_id.id == loc_id) + stock_quants = self.env['stock.quant'].search([('product_id', '=', line.product_id.id), ('location_id', 'child_of', loc_id)]) line.total_reserved_quantity = sum(stock_quants.mapped('reserved_quantity')) @api.depends('qty_delivered', 'quantity_returned')