From 8e0357a8fc35ead67ed7002e4b6fe61c22273cfe Mon Sep 17 00:00:00 2001 From: Mathieu Date: Thu, 4 Jul 2024 10:48:16 +0200 Subject: [PATCH] [IMP] _compute_date_next_reception --- sale_order_line_date_next_reception/models/sale_order_line.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sale_order_line_date_next_reception/models/sale_order_line.py b/sale_order_line_date_next_reception/models/sale_order_line.py index 1e8b6da..ff511a9 100644 --- a/sale_order_line_date_next_reception/models/sale_order_line.py +++ b/sale_order_line_date_next_reception/models/sale_order_line.py @@ -13,7 +13,8 @@ class SaleOrderLine(models.Model): def _compute_date_next_reception(self): for line in self: line.date_next_reception = False - if not(line.product_id.qty_available) and line.state not in ['done', 'cancel']: + qty_available = line.product_id.with_context(warehouse=line.order_id.warehouse_id.id).qty_available + if qty_available <=0 and line.state not in ['done', 'cancel']: picking_model = self.env["stock.picking"] picking_id = picking_model.search([ ('product_id', '=', line.product_id.id),