From e482c846c8150cdc7af83093aa8bbb70ed57f9a6 Mon Sep 17 00:00:00 2001 From: Mihir Kandoi Date: Wed, 17 Jun 2026 17:36:00 +0530 Subject: [PATCH] refactor(postgres): port General Ledger report query to the query builder Co-Authored-By: Claude Opus 4.8 (1M context) --- erpnext/accounts/report/general_ledger/general_ledger.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/erpnext/accounts/report/general_ledger/general_ledger.py b/erpnext/accounts/report/general_ledger/general_ledger.py index 8670a4fd175..042ae1e0e23 100644 --- a/erpnext/accounts/report/general_ledger/general_ledger.py +++ b/erpnext/accounts/report/general_ledger/general_ledger.py @@ -35,7 +35,7 @@ def execute(filters=None): if filters and filters.get("print_in_account_currency") and not filters.get("account"): frappe.throw(_("Select an account to print in account currency")) - for acc in frappe.db.sql("""select name, is_group from tabAccount""", as_dict=1): + for acc in frappe.get_all("Account", fields=["name", "is_group"]): account_details.setdefault(acc.name, acc) if filters.get("party"): @@ -650,10 +650,8 @@ def get_result_as_list(data, filters): def get_supplier_invoice_details(): inv_details = {} - for d in frappe.db.sql( - """ select name, bill_no from `tabPurchase Invoice` - where docstatus = 1 and bill_no is not null and bill_no != '' """, - as_dict=1, + for d in frappe.get_all( + "Purchase Invoice", filters={"docstatus": 1, "bill_no": ["is", "set"]}, fields=["name", "bill_no"] ): inv_details[d.name] = d.bill_no