Account no + account name in trial balance and financial statements reports (#15038)
diff --git a/erpnext/accounts/report/financial_statements.py b/erpnext/accounts/report/financial_statements.py
index b0c49df..1be3d74 100644
--- a/erpnext/accounts/report/financial_statements.py
+++ b/erpnext/accounts/report/financial_statements.py
@@ -185,14 +185,15 @@
has_value = False
total = 0
row = frappe._dict({
- "account_name": _(d.account_name),
"account": _(d.name),
"parent_account": _(d.parent_account),
"indent": flt(d.indent),
"year_start_date": year_start_date,
"year_end_date": year_end_date,
"currency": company_currency,
- "opening_balance": d.get("opening_balance", 0.0) * (1 if balance_must_be=="Debit" else -1)
+ "opening_balance": d.get("opening_balance", 0.0) * (1 if balance_must_be=="Debit" else -1),
+ "account_name": ('{} - {}'.format(_(d.account_number), _(d.account_name))
+ if d.account_number else _(d.account_name))
})
for period in period_list:
if d.get(period.key) and balance_must_be=="Credit":
@@ -253,7 +254,7 @@
out.append({})
def get_accounts(company, root_type):
- return frappe.db.sql("""select name, parent_account, lft, rgt, root_type, report_type, account_name from `tabAccount`
+ return frappe.db.sql("""select name, account_number, parent_account, lft, rgt, root_type, report_type, account_name from `tabAccount`
where company=%s and root_type=%s order by lft""", (company, root_type), as_dict=True)
def filter_accounts(accounts, depth=10):
diff --git a/erpnext/accounts/report/trial_balance/trial_balance.py b/erpnext/accounts/report/trial_balance/trial_balance.py
index 93ffe02..513ae14 100644
--- a/erpnext/accounts/report/trial_balance/trial_balance.py
+++ b/erpnext/accounts/report/trial_balance/trial_balance.py
@@ -51,7 +51,7 @@
filters.to_date = filters.year_end_date
def get_data(filters):
- accounts = frappe.db.sql("""select name, parent_account, account_name, root_type, report_type, lft, rgt
+ accounts = frappe.db.sql("""select name, account_number, parent_account, account_name, root_type, report_type, lft, rgt
from `tabAccount` where company=%s order by lft""", filters.company, as_dict=True)
company_currency = erpnext.get_company_currency(filters.company)
@@ -179,13 +179,14 @@
for d in accounts:
has_value = False
row = {
- "account_name": d.account_name,
"account": d.name,
"parent_account": d.parent_account,
"indent": d.indent,
"from_date": filters.from_date,
"to_date": filters.to_date,
- "currency": company_currency
+ "currency": company_currency,
+ "account_name": ('{} - {}'.format(d.account_number, d.account_name)
+ if d.account_number else d.account_name)
}
prepare_opening_and_closing(d)