From 91d2ace9bbbe31a3fbe0622a970e93857a0c27d5 Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Mon, 30 Jul 2018 10:38:51 +0530 Subject: [PATCH] Account no + account name in trial balance and financial statements reports (#15038) --- erpnext/accounts/report/financial_statements.py | 7 ++++--- erpnext/accounts/report/trial_balance/trial_balance.py | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/erpnext/accounts/report/financial_statements.py b/erpnext/accounts/report/financial_statements.py index b0c49dfbd8..1be3d74185 100644 --- a/erpnext/accounts/report/financial_statements.py +++ b/erpnext/accounts/report/financial_statements.py @@ -185,14 +185,15 @@ def prepare_data(accounts, balance_must_be, period_list, company_currency): 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 @@ def add_total_row(out, root_type, balance_must_be, period_list, company_currency 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 93ffe0279f..513ae148a1 100644 --- a/erpnext/accounts/report/trial_balance/trial_balance.py +++ b/erpnext/accounts/report/trial_balance/trial_balance.py @@ -51,7 +51,7 @@ def validate_filters(filters): 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 @@ def prepare_data(accounts, filters, total_row, parent_children_map, company_curr 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)