mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-16 16:08:39 +00:00
test: update cascading test to assert zero-qty reservation for stock-covered items
This commit is contained in:
@@ -212,13 +212,15 @@ class TestProductionPlan(FrappeTestCase):
|
||||
quantities = [d["quantity"] for d in mr_items]
|
||||
rm_qty = sum(quantities)
|
||||
|
||||
# Only 2 MR item created - the first SO's requirement is fully covered by stock (v15 behaviour)
|
||||
self.assertEqual(len(mr_items), 2)
|
||||
self.assertEqual(rm_qty, 2, "Cascading failed: total MR qty should be 2 (3 needed - 1 in stock)")
|
||||
# 3 MR items: SO1's requirement is covered by stock (qty=0 but reserved), SO2 and SO3 need 1 each
|
||||
self.assertEqual(len(mr_items), 3)
|
||||
self.assertEqual(
|
||||
rm_qty, 2, "Cascading failed: total purchase qty should be 2 (3 needed - 1 in stock)"
|
||||
)
|
||||
self.assertEqual(
|
||||
quantities,
|
||||
[1, 1],
|
||||
"Cascading failed: only second and third SO should need procurement (qty=1) since first SO consumed stock",
|
||||
[0, 1, 1],
|
||||
"SO1 stock-covered item should appear with qty=0 for reservation; SO2 and SO3 need qty=1",
|
||||
)
|
||||
|
||||
sr.cancel()
|
||||
@@ -251,11 +253,13 @@ class TestProductionPlan(FrappeTestCase):
|
||||
pln = create_production_plan(
|
||||
item_code="Test Production Item 1", use_multi_level_bom=0, ignore_existing_ordered_qty=0
|
||||
)
|
||||
self.assertFalse(len(pln.mr_items))
|
||||
|
||||
items_needing_purchase = [row.item_code for row in pln.mr_items if row.quantity > 0]
|
||||
self.assertFalse(len(items_needing_purchase))
|
||||
|
||||
pln.cancel()
|
||||
sr1.cancel()
|
||||
sr2.cancel()
|
||||
pln.cancel()
|
||||
|
||||
def test_production_plan_sales_orders(self):
|
||||
"Test if previously fulfilled SO (with WO) is pulled into Prod Plan."
|
||||
|
||||
Reference in New Issue
Block a user