mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-31 18:59:08 +00:00
test: make corrections to tests based on v15 functionality
This commit is contained in:
@@ -165,6 +165,7 @@ class TestProductionPlan(FrappeTestCase):
|
|||||||
# Sales orders
|
# Sales orders
|
||||||
so1 = make_sales_order(item_code=fg_item_a, qty=1)
|
so1 = make_sales_order(item_code=fg_item_a, qty=1)
|
||||||
so2 = make_sales_order(item_code=fg_item_a, qty=1)
|
so2 = make_sales_order(item_code=fg_item_a, qty=1)
|
||||||
|
so3 = make_sales_order(item_code=fg_item_a, qty=1)
|
||||||
|
|
||||||
# Production plan
|
# Production plan
|
||||||
pln = frappe.get_doc(
|
pln = frappe.get_doc(
|
||||||
@@ -194,6 +195,15 @@ class TestProductionPlan(FrappeTestCase):
|
|||||||
"grand_total": so2.grand_total,
|
"grand_total": so2.grand_total,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
pln.append(
|
||||||
|
"sales_orders",
|
||||||
|
{
|
||||||
|
"sales_order": so3.name,
|
||||||
|
"sales_order_date": so3.transaction_date,
|
||||||
|
"customer": so3.customer,
|
||||||
|
"grand_total": so3.grand_total,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
pln.get_items()
|
pln.get_items()
|
||||||
pln.insert()
|
pln.insert()
|
||||||
@@ -202,12 +212,13 @@ class TestProductionPlan(FrappeTestCase):
|
|||||||
quantities = [d["quantity"] for d in mr_items]
|
quantities = [d["quantity"] for d in mr_items]
|
||||||
rm_qty = sum(quantities)
|
rm_qty = sum(quantities)
|
||||||
|
|
||||||
self.assertEqual(len(mr_items), 2) # one for each SO
|
# Only 2 MR item created - the first SO's requirement is fully covered by stock (v15 behaviour)
|
||||||
self.assertEqual(rm_qty, 1, "Cascading failed: total MR qty should be 1 (2 needed - 1 in stock)")
|
self.assertEqual(len(mr_items), 2)
|
||||||
|
self.assertEqual(rm_qty, 2, "Cascading failed: total MR qty should be 2 (3 needed - 1 in stock)")
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
quantities,
|
quantities,
|
||||||
[0, 1],
|
[1, 1],
|
||||||
"Cascading failed: first item should consume stock (qty=0), second should need procurement (qty=1)",
|
"Cascading failed: only second and third SO should need procurement (qty=1) since first SO consumed stock",
|
||||||
)
|
)
|
||||||
|
|
||||||
sr.cancel()
|
sr.cancel()
|
||||||
|
|||||||
Reference in New Issue
Block a user