Skip to content

Commit

Permalink
[FIX] stock_available_mrp: increment potencial_qty to immediately_usa…
Browse files Browse the repository at this point in the history
…ble_qty instead of replacing it
  • Loading branch information
ACheung-FactorLibre committed Dec 9, 2024
1 parent d9f406f commit 0d299a1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
2 changes: 1 addition & 1 deletion stock_available_mrp/models/product_product.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
14 changes: 1 addition & 13 deletions stock_available_mrp/tests/test_potential_qty.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
}
)
Expand Down

0 comments on commit 0d299a1

Please sign in to comment.