mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-15 15:38:39 +00:00
refactor(accounts): use frappe.get_all for trial balance account fetch
The Account metadata fetch in the DuckDB trial-balance path is a plain static SELECT (fixed columns, single company filter, order by lft). Convert it to frappe.get_all. Verified on Postgres: identical 98 rows, same order and same dict payload as the raw query.
This commit is contained in:
@@ -597,11 +597,21 @@ def execute_synced_report(filters):
|
||||
|
||||
def get_data_duckdb(filters, conn):
|
||||
# accounts and all metadata via frappe.db — only GL Entry comes from DuckDB
|
||||
accounts = frappe.db.sql(
|
||||
"""select name, account_number, parent_account, account_name, root_type, report_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",
|
||||
"is_group",
|
||||
"lft",
|
||||
"rgt",
|
||||
],
|
||||
order_by="lft",
|
||||
)
|
||||
if not accounts:
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user