From f42f1bb35fa445c87206db9ce19df0e6dfde98b0 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Tue, 30 Jul 2024 14:25:23 +0530 Subject: [PATCH] fix: performance issue for the report Purchase Order Analysis report (backport #42503) (#42506) * fix: performance issue for the report Purchase Order Analysis report (#42503) (cherry picked from commit cb522f8f22df6688438994d0d2c47f32984aebd6) # Conflicts: # erpnext/buying/report/purchase_order_analysis/purchase_order_analysis.py * chore: fix conflicts --------- Co-authored-by: rohitwaghchaure --- .../purchase_order_analysis/purchase_order_analysis.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/erpnext/buying/report/purchase_order_analysis/purchase_order_analysis.py b/erpnext/buying/report/purchase_order_analysis/purchase_order_analysis.py index b23c3f50b9a..da1c70d3179 100644 --- a/erpnext/buying/report/purchase_order_analysis/purchase_order_analysis.py +++ b/erpnext/buying/report/purchase_order_analysis/purchase_order_analysis.py @@ -43,9 +43,10 @@ def get_data(filters): query = ( frappe.qb.from_(po) - .from_(po_item) + .inner_join(po_item) + .on(po_item.parent == po.name) .left_join(pi_item) - .on(pi_item.po_detail == po_item.name) + .on((pi_item.po_detail == po_item.name) & (pi_item.docstatus == 1)) .select( po.transaction_date.as_("date"), po_item.schedule_date.as_("required_date"),