From 0d299a10429738f3bbf6707bd6463fa954fbd474 Mon Sep 17 00:00:00 2001 From: Alejandro Ji Cheung Date: Mon, 9 Dec 2024 12:13:29 +0100 Subject: [PATCH] [FIX] stock_available_mrp: increment potencial_qty to immediately_usable_qty instead of replacing it --- stock_available_mrp/models/product_product.py | 2 +- stock_available_mrp/tests/test_potential_qty.py | 14 +------------- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/stock_available_mrp/models/product_product.py b/stock_available_mrp/models/product_product.py index 658b9d49..6bf3c518 100644 --- a/stock_available_mrp/models/product_product.py +++ b/stock_available_mrp/models/product_product.py @@ -77,7 +77,7 @@ def _compute_available_quantities_dict(self): ) res[product.id]["potential_qty"] = potential_qty - res[product.id]["immediately_usable_qty"] = potential_qty + res[product.id]["immediately_usable_qty"] += potential_qty return res, stock_dict diff --git a/stock_available_mrp/tests/test_potential_qty.py b/stock_available_mrp/tests/test_potential_qty.py index 6492d318..f7e3f15c 100644 --- a/stock_available_mrp/tests/test_potential_qty.py +++ b/stock_available_mrp/tests/test_potential_qty.py @@ -63,12 +63,6 @@ def setup_demo_data(cls): # A product without a BoM cls.product_wo_bom = cls.env.ref("product.product_product_11") - # Record the initial quantity available for sale - cls.initial_usable_qties = { - i.id: i.immediately_usable_qty - for i in [cls.tmpl, cls.var1, cls.var2, cls.product_wo_bom] - } - def create_inventory(self, product, qty, location=None, company_id=None): if location is None: location = self.wh_main.lot_stock_id @@ -101,12 +95,6 @@ def assertPotentialQty(self, record, qty, msg): record.invalidate_model() # Check the potential self.assertEqual(record.potential_qty, qty, msg) - # Check the variation of quantity available for sale - self.assertEqual( - (record.immediately_usable_qty - self.initial_usable_qties[record.id]), - qty, - msg, - ) def test_01_potential_qty_no_bom(self): #  Check the potential when there's no BoM @@ -413,7 +401,7 @@ def test_product_phantom(self): { "bom_id": bom.id, "product_id": bom_product.id, - "product_qty": 1, + "product_qty": 3, "product_uom_id": self.env.ref("uom.product_uom_unit").id, } )