From 632c08f7e0b0c6a932457afdfa484f7668e9a9e5 Mon Sep 17 00:00:00 2001 From: s-aga-r Date: Mon, 5 Dec 2022 22:47:05 +0530 Subject: [PATCH] fix: order status in `Production Planning Report` --- .../production_planning_report.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/erpnext/manufacturing/report/production_planning_report/production_planning_report.py b/erpnext/manufacturing/report/production_planning_report/production_planning_report.py index 16c25ce7e6..109d9ab656 100644 --- a/erpnext/manufacturing/report/production_planning_report/production_planning_report.py +++ b/erpnext/manufacturing/report/production_planning_report/production_planning_report.py @@ -49,7 +49,7 @@ class ProductionPlanReport(object): parent.bom_no, parent.fg_warehouse.as_("warehouse"), ) - .where(parent.status.notin(["Completed", "Stopped"])) + .where(parent.status.notin(["Completed", "Stopped", "Closed"])) ) if order_by == "Planned Start Date": @@ -79,10 +79,11 @@ class ProductionPlanReport(object): query = query.where(child.parent.isin(self.filters.docnames)) if doctype == "Sales Order": - query = query.select( - child.delivery_date, - parent.base_grand_total, - ).where((child.stock_qty > child.produced_qty) & (parent.per_delivered < 100.0)) + query = query.select(child.delivery_date, parent.base_grand_total,).where( + (child.stock_qty > child.produced_qty) + & (parent.per_delivered < 100.0) + & (parent.status.notin(["Completed", "Closed"])) + ) if order_by == "Delivery Date": query = query.orderby(child.delivery_date, order=Order.asc) @@ -91,7 +92,9 @@ class ProductionPlanReport(object): elif doctype == "Material Request": query = query.select(child.schedule_date,).where( - (parent.per_ordered < 100) & (parent.material_request_type == "Manufacture") + (parent.per_ordered < 100) + & (parent.material_request_type == "Manufacture") + & (parent.status != "Stopped") ) if order_by == "Required Date":