diff --git a/src/accounting/report/reports/income_expenses.py b/src/accounting/report/reports/income_expenses.py index 1571ecf..5ddca46 100644 --- a/src/accounting/report/reports/income_expenses.py +++ b/src/accounting/report/reports/income_expenses.py @@ -160,6 +160,7 @@ class EntryCollector: JournalEntry.currency_code == self.__currency.code, sa.not_(self.__account_condition)) .order_by(Transaction.date, + Transaction.no, JournalEntry.is_debit, JournalEntry.no) .options(selectinload(JournalEntry.account), diff --git a/src/accounting/report/reports/journal.py b/src/accounting/report/reports/journal.py index 45243d7..4dab479 100644 --- a/src/accounting/report/reports/journal.py +++ b/src/accounting/report/reports/journal.py @@ -188,6 +188,7 @@ class Journal(BaseReport): return JournalEntry.query.join(Transaction)\ .filter(*conditions)\ .order_by(Transaction.date, + Transaction.no, JournalEntry.is_debit.desc(), JournalEntry.no)\ .options(selectinload(JournalEntry.account), diff --git a/src/accounting/report/reports/ledger.py b/src/accounting/report/reports/ledger.py index 70cb03e..abec6f9 100644 --- a/src/accounting/report/reports/ledger.py +++ b/src/accounting/report/reports/ledger.py @@ -149,6 +149,7 @@ class EntryCollector: return [ReportEntry(x) for x in JournalEntry.query.join(Transaction) .filter(*conditions) .order_by(Transaction.date, + Transaction.no, JournalEntry.is_debit.desc(), JournalEntry.no) .options(selectinload(JournalEntry.transaction)).all()] diff --git a/src/accounting/report/reports/search.py b/src/accounting/report/reports/search.py index e5ac29d..bc39912 100644 --- a/src/accounting/report/reports/search.py +++ b/src/accounting/report/reports/search.py @@ -71,6 +71,7 @@ class EntryCollector: conditions.append(sa.or_(*sub_conditions)) return JournalEntry.query.join(Transaction).filter(*conditions)\ .order_by(Transaction.date, + Transaction.no, JournalEntry.is_debit, JournalEntry.no)\ .options(selectinload(JournalEntry.account),