From 5e93b02c85042bc591b5aeb2e9f40c153f75ec59 Mon Sep 17 00:00:00 2001 From: Helkyd Date: Fri, 2 Feb 2018 12:27:30 +0000 Subject: [PATCH] Update trial_balance.py Assuming that Account_number has NUMBERs will sort. --- erpnext/accounts/report/trial_balance/trial_balance.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/report/trial_balance/trial_balance.py b/erpnext/accounts/report/trial_balance/trial_balance.py index f484111be3..7142c69955 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, parent_account, account_name, account_number, root_type, report_type, lft, rgt from `tabAccount` where company=%s order by account_name, lft""", filters.company, as_dict=True) company_currency = erpnext.get_company_currency(filters.company) @@ -176,7 +176,7 @@ def accumulate_values_into_parents(accounts, accounts_by_name): def prepare_data(accounts, filters, total_row, parent_children_map, company_currency): data = [] tmpaccnt = sorted(accounts) - if accounts[0].account_name[0].isnumeric(): + if not (accounts[0].account_number is None): accounts = tmpaccnt for d in accounts: