From 7414c84313e3ec6c29b45098b903be0c966a6185 Mon Sep 17 00:00:00 2001 From: sbejaoui Date: Wed, 9 Jun 2021 14:59:12 +0200 Subject: [PATCH] [FIX] - local variable referenced before assignment --- stock_available_mrp/models/product_product.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/stock_available_mrp/models/product_product.py b/stock_available_mrp/models/product_product.py index 988f10544..dfa1834f3 100644 --- a/stock_available_mrp/models/product_product.py +++ b/stock_available_mrp/models/product_product.py @@ -95,21 +95,21 @@ class ProductProduct(models.Model): for component, need in component_needs.items() ] ) - - bom_id = product.bom_id - potential_qty = bom_id.product_qty * components_potential_qty + potential_qty = product.bom_id.product_qty * components_potential_qty potential_qty = potential_qty > 0.0 and potential_qty or 0.0 # We want to respect the rounding factor of the potential_qty # Rounding down as we want to be pesimistic. - potential_qty = bom_id.product_uom_id._compute_quantity( + potential_qty = product.bom_id.product_uom_id._compute_quantity( potential_qty, product.bom_id.product_tmpl_id.uom_id, rounding_method="DOWN", ) res[product.id]["potential_qty"] = potential_qty - immediately_usable_qty = potential_qty if bom_id.type != "phantom" else 0 + immediately_usable_qty = ( + potential_qty if product.bom_id.type != "phantom" else 0 + ) res[product.id]["immediately_usable_qty"] += immediately_usable_qty return res, stock_dict