mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-15 07:28:39 +00:00
fix: report full planned qty as pending when a plan has no work order
This commit is contained in:
@@ -42,7 +42,9 @@ def get_production_plan_item_details(filters, data, order_details):
|
||||
|
||||
order_qty = row.planned_qty
|
||||
total_produced_qty = 0.0
|
||||
pending_qty = 0.0
|
||||
# default to the full planned qty so a plan without any work order still
|
||||
# reports everything as pending rather than a misleading zero
|
||||
pending_qty = flt(order_qty)
|
||||
for work_order in work_orders:
|
||||
produced_qty = flt(order_details.get((work_order, row.item_code), {}).get("produced_qty", 0))
|
||||
pending_qty = flt(order_qty) - produced_qty
|
||||
|
||||
@@ -72,6 +72,8 @@ class TestProductionPlanSummary(ERPNextTestSuite):
|
||||
self.assertIsNotNone(summary)
|
||||
self.assertEqual(summary.get("qty"), 2)
|
||||
self.assertEqual(summary.get("produced_qty"), 0)
|
||||
# nothing produced yet, so the whole planned qty is pending
|
||||
self.assertEqual(summary.get("pending_qty"), 2)
|
||||
self.assertIsNone(self.get_work_order_row(data, "_Test FG Item"))
|
||||
|
||||
def test_summary_with_pending_work_order(self):
|
||||
|
||||
Reference in New Issue
Block a user