[FIX] mrp_multi_level: starting qty on hand wrong when using lots

Unify the way to get the starting on hand whenever needed in MRP
calculations.
This commit is contained in:
Lois Rilo
2024-01-22 15:53:58 -07:00
parent fbd28ad7dc
commit 85d466a3dc
3 changed files with 61 additions and 22 deletions

View File

@@ -524,3 +524,12 @@ class TestMrpMultiLevel(TestMrpMultiLevelCommon):
f"unexpected value for {key}: {inv[key]} "
f"(expected {test_vals[key]} on {inv.date}",
)
def test_19_on_hand_with_lots(self):
"""Check that on-hand is correctly computed when tracking by lots."""
lots_line_1 = self.mrp_inventory_obj.search(
[("product_mrp_area_id.product_id", "=", self.product_lots.id)]
)
self.assertEqual(len(lots_line_1), 1)
self.assertEqual(lots_line_1.initial_on_hand_qty, 210)
self.assertEqual(lots_line_1.final_on_hand_qty, 185)