fix: Sort account balances by account name

This commit is contained in:
Deepesh Garg 2021-06-10 18:09:49 +05:30
parent 8975c5241e
commit a5c3427293
2 changed files with 12 additions and 14 deletions

View File

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

View File

@ -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])