From c4220b79a800fca1f5284ecdf036675073d22991 Mon Sep 17 00:00:00 2001 From: sbejaoui Date: Wed, 9 Jun 2021 10:25:25 +0200 Subject: [PATCH] [IMP] - use available_quantity to compute contains_unreserved --- stock_available_unreserved/models/stock_quant.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/stock_available_unreserved/models/stock_quant.py b/stock_available_unreserved/models/stock_quant.py index b2b251295..d7563b59b 100644 --- a/stock_available_unreserved/models/stock_quant.py +++ b/stock_available_unreserved/models/stock_quant.py @@ -14,14 +14,13 @@ class StockQuant(models.Model): store=True, ) - @api.depends("product_id", "location_id", "quantity", "reserved_quantity") + @api.depends("quantity", "reserved_quantity") def _compute_contains_unreserved(self): for record in self: # Avoid error when adding a new line on manually Update Quantity if isinstance(record.id, models.NewId): record.contains_unreserved = False continue - available = record._get_available_quantity( - record.product_id, record.location_id + record.contains_unreserved = ( + True if record.available_quantity > 0 else False ) - record.contains_unreserved = True if available > 0 else False