chore: Remove unnecessary list comprehension
diff --git a/erpnext/accounts/report/balance_sheet/balance_sheet.py b/erpnext/accounts/report/balance_sheet/balance_sheet.py
index c831b78..b225aac 100644
--- a/erpnext/accounts/report/balance_sheet/balance_sheet.py
+++ b/erpnext/accounts/report/balance_sheet/balance_sheet.py
@@ -98,7 +98,7 @@
chart = get_chart_data(filters, columns, asset, liability, equity)
report_summary = get_report_summary(
- period_list, asset, liability, equity, provisional_profit_loss, total_credit, currency, filters
+ period_list, asset, liability, equity, provisional_profit_loss, currency, filters
)
return columns, data, message, chart, report_summary
@@ -176,7 +176,6 @@
liability,
equity,
provisional_profit_loss,
- total_credit,
currency,
filters,
consolidated=False,
diff --git a/erpnext/accounts/report/financial_statements.py b/erpnext/accounts/report/financial_statements.py
index 9bb05fd..cd01a35 100644
--- a/erpnext/accounts/report/financial_statements.py
+++ b/erpnext/accounts/report/financial_statements.py
@@ -418,23 +418,15 @@
ignore_closing_entries=False,
):
"""Returns a dict like { "account": [gl entries], ... }"""
-
gl_entries = []
- account = frappe.qb.DocType("Account")
- accounts = (
- frappe.qb.from_(account)
- .select(account.name)
- .where(account.lft >= root_lft)
- .where(account.rgt <= root_rgt)
- .where(account.company == company)
- .run(as_dict=True)
+ accounts_list = frappe.db.get_all(
+ "Account",
+ filters={"company": company, "is_group": 0, "lft": (">=", root_lft), "rgt": ("<=", root_rgt)},
+ pluck="name",
)
- accounts_list = [account.name for account in accounts]
-
if accounts_list:
-
# For balance sheet
if not from_date:
from_date = filters["period_start_date"]
@@ -493,8 +485,6 @@
.where(gl_entry.company == filters.company)
)
- query = query.where(gl_entry.account.isin(accounts))
-
if doctype == "GL Entry":
query = query.select(gl_entry.posting_date, gl_entry.is_opening, gl_entry.fiscal_year)
query = query.where(gl_entry.is_cancelled == 0)
@@ -504,6 +494,7 @@
query = query.where(gl_entry.period_closing_voucher == period_closing_voucher)
query = apply_additional_conditions(doctype, query, from_date, ignore_closing_entries, filters)
+ query = query.where(gl_entry.account.isin(accounts))
entries = query.run(as_dict=True)