diff --git a/erpnext/accounts/report/consolidated_trial_balance/consolidated_trial_balance.py b/erpnext/accounts/report/consolidated_trial_balance/consolidated_trial_balance.py index fc4affad3a7..17d0b9e1a6a 100644 --- a/erpnext/accounts/report/consolidated_trial_balance/consolidated_trial_balance.py +++ b/erpnext/accounts/report/consolidated_trial_balance/consolidated_trial_balance.py @@ -126,12 +126,22 @@ def get_data(filters) -> list[list]: def get_company_wise_tb_data(filters, reporting_currency, ignore_reporting_currency): - accounts = frappe.db.sql( - """select name, account_number, parent_account, account_name, root_type, report_type, account_type, is_group, lft, rgt - - from `tabAccount` where company=%s order by lft""", - filters.company, - as_dict=True, + accounts = frappe.get_all( + "Account", + filters={"company": filters.company}, + fields=[ + "name", + "account_number", + "parent_account", + "account_name", + "root_type", + "report_type", + "account_type", + "is_group", + "lft", + "rgt", + ], + order_by="lft", ) ignore_is_opening = frappe.get_single_value("Accounts Settings", "ignore_is_opening_check_for_reporting")