From af8aa153bf13f8b6b9bee019a64b0817d65278a5 Mon Sep 17 00:00:00 2001 From: Kavin <78342682+kavin0411@users.noreply.github.com> Date: Wed, 8 Oct 2025 16:19:24 +0530 Subject: [PATCH 1/2] fix: sum quantity instead of requried BOM quantity --- .../manufacturing/doctype/production_plan/production_plan.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/manufacturing/doctype/production_plan/production_plan.py b/erpnext/manufacturing/doctype/production_plan/production_plan.py index 97a6fe49b0e..d8823e649bb 100644 --- a/erpnext/manufacturing/doctype/production_plan/production_plan.py +++ b/erpnext/manufacturing/doctype/production_plan/production_plan.py @@ -1927,7 +1927,7 @@ def get_reserved_qty_for_production_plan(item_code, warehouse): frappe.qb.from_(table) .inner_join(child) .on(table.name == child.parent) - .select(Sum(child.required_bom_qty)) + .select(Sum(child.quantity)) .where( (table.docstatus == 1) & (child.item_code == item_code) From 1c586697c7a5f600af3ed591a6c4f7c95f0070a7 Mon Sep 17 00:00:00 2001 From: Kavin <78342682+kavin0411@users.noreply.github.com> Date: Mon, 13 Oct 2025 00:02:00 +0530 Subject: [PATCH 2/2] fix: handle multi uom in reserved qty for production plan --- .../manufacturing/doctype/production_plan/production_plan.py | 3 ++- .../doctype/production_plan/test_production_plan.py | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/manufacturing/doctype/production_plan/production_plan.py b/erpnext/manufacturing/doctype/production_plan/production_plan.py index d8823e649bb..83d161e134f 100644 --- a/erpnext/manufacturing/doctype/production_plan/production_plan.py +++ b/erpnext/manufacturing/doctype/production_plan/production_plan.py @@ -965,6 +965,7 @@ class ProductionPlan(Document): if material_request_type == "Material Transfer" else None, "qty": item.quantity - item.requested_qty, + "uom": item.uom, "schedule_date": schedule_date, "warehouse": item.warehouse, "sales_order": item.sales_order, @@ -1927,7 +1928,7 @@ def get_reserved_qty_for_production_plan(item_code, warehouse): frappe.qb.from_(table) .inner_join(child) .on(table.name == child.parent) - .select(Sum(child.quantity)) + .select(Sum(child.quantity * child.conversion_factor)) .where( (table.docstatus == 1) & (child.item_code == item_code) diff --git a/erpnext/manufacturing/doctype/production_plan/test_production_plan.py b/erpnext/manufacturing/doctype/production_plan/test_production_plan.py index e29d06a4821..d583c9ddded 100644 --- a/erpnext/manufacturing/doctype/production_plan/test_production_plan.py +++ b/erpnext/manufacturing/doctype/production_plan/test_production_plan.py @@ -1256,7 +1256,6 @@ class TestProductionPlan(IntegrationTestCase): after_qty = flt(frappe.db.get_value("Bin", bin_name, "reserved_qty_for_production_plan")) self.assertEqual(after_qty, before_qty) - completed_plans = get_non_completed_production_plans() for plan in plans: self.assertFalse(plan in completed_plans)