Update trial_balance.py

Assuming that Account_number has NUMBERs will sort.
This commit is contained in:
Helkyd 2018-02-02 12:27:30 +00:00 committed by GitHub
parent b258686b00
commit 5e93b02c85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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: