From 1cd40fd1920a7e7d97ca22d866b1f307bc901675 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Mart=C3=ADnez?= Date: Tue, 22 Feb 2022 14:20:14 +0100 Subject: [PATCH] [FIX] stock_available_mrp: Set correctlly immediately_usable_qty value. TT27873 --- stock_available_mrp/models/product_product.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/stock_available_mrp/models/product_product.py b/stock_available_mrp/models/product_product.py index 293ae430a..569a75c1a 100644 --- a/stock_available_mrp/models/product_product.py +++ b/stock_available_mrp/models/product_product.py @@ -86,7 +86,7 @@ class ProductProduct(models.Model): bom_id = product.bom_id if not component_needs: # The BoM has no line we can use - potential_qty = immediately_usable_qty = 0.0 + potential_qty = 0.0 else: # Find the lowest quantity we can make with the stock at hand components_potential_qty = min( @@ -109,8 +109,7 @@ class ProductProduct(models.Model): ) res[product.id]["potential_qty"] = potential_qty - immediately_usable_qty = potential_qty if bom_id.type != "phantom" else 0 - res[product.id]["immediately_usable_qty"] += immediately_usable_qty + res[product.id]["immediately_usable_qty"] = potential_qty return res, stock_dict