diff --git a/erpnext/accounts/report/account_balance/account_balance.py b/erpnext/accounts/report/account_balance/account_balance.py index 65e7d789bb..be64c327fd 100644 --- a/erpnext/accounts/report/account_balance/account_balance.py +++ b/erpnext/accounts/report/account_balance/account_balance.py @@ -58,11 +58,9 @@ def get_conditions(filters): def get_data(filters): data = [] - conditions = get_conditions(filters) - accounts = frappe.db.get_all("Account", fields=["name", "account_currency"], - filters=conditions) + filters=conditions, order_by='name') for d in accounts: balance = get_balance_on(d.name, date=filters.report_date) diff --git a/erpnext/accounts/report/account_balance/test_account_balance.py b/erpnext/accounts/report/account_balance/test_account_balance.py index b6ced312d0..14ddf4a30f 100644 --- a/erpnext/accounts/report/account_balance/test_account_balance.py +++ b/erpnext/accounts/report/account_balance/test_account_balance.py @@ -23,7 +23,7 @@ class TestAccountBalance(unittest.TestCase): expected_data = [ { - "account": 'Sales - _TC2', + "account": 'Direct Income - _TC2', "currency": 'EUR', "balance": -100.0, }, @@ -32,21 +32,21 @@ class TestAccountBalance(unittest.TestCase): "currency": 'EUR', "balance": -100.0, }, - { - "account": 'Service - _TC2', - "currency": 'EUR', - "balance": 0.0, - }, - { - "account": 'Direct Income - _TC2', - "currency": 'EUR', - "balance": -100.0, - }, { "account": 'Indirect Income - _TC2', "currency": 'EUR', "balance": 0.0, }, + { + "account": 'Sales - _TC2', + "currency": 'EUR', + "balance": -100.0, + }, + { + "account": 'Service - _TC2', + "currency": 'EUR', + "balance": 0.0, + } ] self.assertEqual(expected_data, report[1])