From fb2df77da2c97e665f685a4f2503a8a1240ec01b Mon Sep 17 00:00:00 2001 From: ljain112 Date: Tue, 27 May 2025 16:51:52 +0530 Subject: [PATCH] fix: use pypika object `LiteralValue` for adding match conditions (cherry picked from commit 9093e5e3636f4c3cbd9fcb89387268f584c05947) --- .../customer_ledger_summary/customer_ledger_summary.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/accounts/report/customer_ledger_summary/customer_ledger_summary.py b/erpnext/accounts/report/customer_ledger_summary/customer_ledger_summary.py index 1648166d041..42a6358cdfe 100644 --- a/erpnext/accounts/report/customer_ledger_summary/customer_ledger_summary.py +++ b/erpnext/accounts/report/customer_ledger_summary/customer_ledger_summary.py @@ -8,6 +8,7 @@ from frappe.query_builder import Criterion, Tuple from frappe.query_builder.functions import IfNull from frappe.utils import getdate, nowdate from frappe.utils.nestedset import get_descendants_of +from pypika.terms import LiteralValue from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import ( get_accounting_dimensions, @@ -77,13 +78,12 @@ class PartyLedgerSummaryReport: from frappe.desk.reportview import build_match_conditions - query, params = query.walk() match_conditions = build_match_conditions(party_type) if match_conditions: - query += "and" + match_conditions + query = query.where(LiteralValue(match_conditions)) - party_details = frappe.db.sql(query, params, as_dict=True) + party_details = query.run(as_dict=True) for row in party_details: self.parties.append(row.party)