fix: Sort account balances by account name
diff --git a/erpnext/accounts/report/account_balance/account_balance.py b/erpnext/accounts/report/account_balance/account_balance.py
index 65e7d78..be64c32 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_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 b6ced31..14ddf4a 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 @@
expected_data = [
{
- "account": 'Sales - _TC2',
+ "account": 'Direct Income - _TC2',
"currency": 'EUR',
"balance": -100.0,
},
@@ -33,20 +33,20 @@
"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])