From 14091a8996547c8fe428ed8fdb960cf8934acc8f Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 2 Jul 2026 13:58:31 +0530 Subject: [PATCH] fix: report full planned qty as pending when a plan has no work order --- .../report/production_plan_summary/production_plan_summary.py | 4 +++- .../production_plan_summary/test_production_plan_summary.py | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/erpnext/manufacturing/report/production_plan_summary/production_plan_summary.py b/erpnext/manufacturing/report/production_plan_summary/production_plan_summary.py index d7920af8141..82e150f807a 100644 --- a/erpnext/manufacturing/report/production_plan_summary/production_plan_summary.py +++ b/erpnext/manufacturing/report/production_plan_summary/production_plan_summary.py @@ -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 diff --git a/erpnext/manufacturing/report/production_plan_summary/test_production_plan_summary.py b/erpnext/manufacturing/report/production_plan_summary/test_production_plan_summary.py index fc47a3065d1..674c653b12e 100644 --- a/erpnext/manufacturing/report/production_plan_summary/test_production_plan_summary.py +++ b/erpnext/manufacturing/report/production_plan_summary/test_production_plan_summary.py @@ -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):