From a0fba6387fb1066a97e84b0dd864f79d13561ce5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=9D=E7=91=AA=E8=B2=93?= Date: Sat, 11 Mar 2023 01:01:05 +0800 Subject: [PATCH] Added the order to the search report. --- src/accounting/report/reports/search.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/accounting/report/reports/search.py b/src/accounting/report/reports/search.py index ddef409..8abd93e 100644 --- a/src/accounting/report/reports/search.py +++ b/src/accounting/report/reports/search.py @@ -68,7 +68,10 @@ class EntryCollector: except ArithmeticError: pass conditions.append(sa.or_(*sub_conditions)) - return JournalEntry.query.filter(*conditions)\ + return JournalEntry.query.join(Transaction).filter(*conditions)\ + .order_by(Transaction.date, + JournalEntry.is_debit, + JournalEntry.no)\ .options(selectinload(JournalEntry.account), selectinload(JournalEntry.currency), selectinload(JournalEntry.transaction)).all()