Skip to content
Snippets Groups Projects
Commit d6a18656 authored by Atul Patel's avatar Atul Patel
Browse files

[FIX] mrp: incorrect computation of the on-hand qty of a kit

ref : https://github.com/odoo/odoo/commit/d3b482b1d6c9f19ff428b3918c0e09b11c87c873


more then 3 upgrade requests failed.

closes odoo/odoo#105627

Signed-off-by: default avatarDjamel Touati (otd) <otd@odoo.com>
parent 68f29fda
No related branches found
No related tags found
No related merge requests found
......@@ -161,11 +161,11 @@ class ProductProduct(models.Model):
ratios_free_qty.append(component_res["free_qty"] / qty_per_kit)
if bom_sub_lines and ratios_virtual_available: # Guard against all cnsumable bom: at least one ratio should be present.
res[product.id] = {
'virtual_available': min(ratios_virtual_available) // 1,
'qty_available': min(ratios_qty_available) // 1,
'incoming_qty': min(ratios_incoming_qty) // 1,
'outgoing_qty': min(ratios_outgoing_qty) // 1,
'free_qty': min(ratios_free_qty) // 1,
'virtual_available': min(ratios_virtual_available) * bom_kits[product].product_qty // 1,
'qty_available': min(ratios_qty_available) * bom_kits[product].product_qty // 1,
'incoming_qty': min(ratios_incoming_qty) * bom_kits[product].product_qty // 1,
'outgoing_qty': min(ratios_outgoing_qty) * bom_kits[product].product_qty // 1,
'free_qty': min(ratios_free_qty) * bom_kits[product].product_qty // 1,
}
else:
res[product.id] = {
......
......@@ -276,7 +276,7 @@ class TestBoM(TestMrpCommon):
# ending the recurse call to not call the compute method and just left the Falsy value `0.0`
# for the components available qty.
kit_product_qty, _, _ = (self.product_7_3 + self.product_2 + self.product_3).mapped("qty_available")
self.assertEqual(kit_product_qty, 2)
self.assertEqual(kit_product_qty, 8)
def test_13_negative_on_hand_qty(self):
# We set the Product Unit of Measure digits to 5.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment