Fixed the journal, the ledger, the income ane expenses log, and the search result to respect the transaction number before the debit/credit and the journal entry nuber.

This commit is contained in:
依瑪貓 2023-03-17 22:39:29 +08:00
parent d88b3ac770
commit 08d1e60238
4 changed files with 4 additions and 0 deletions

View File

@ -160,6 +160,7 @@ class EntryCollector:
JournalEntry.currency_code == self.__currency.code, JournalEntry.currency_code == self.__currency.code,
sa.not_(self.__account_condition)) sa.not_(self.__account_condition))
.order_by(Transaction.date, .order_by(Transaction.date,
Transaction.no,
JournalEntry.is_debit, JournalEntry.is_debit,
JournalEntry.no) JournalEntry.no)
.options(selectinload(JournalEntry.account), .options(selectinload(JournalEntry.account),

View File

@ -188,6 +188,7 @@ class Journal(BaseReport):
return JournalEntry.query.join(Transaction)\ return JournalEntry.query.join(Transaction)\
.filter(*conditions)\ .filter(*conditions)\
.order_by(Transaction.date, .order_by(Transaction.date,
Transaction.no,
JournalEntry.is_debit.desc(), JournalEntry.is_debit.desc(),
JournalEntry.no)\ JournalEntry.no)\
.options(selectinload(JournalEntry.account), .options(selectinload(JournalEntry.account),

View File

@ -149,6 +149,7 @@ class EntryCollector:
return [ReportEntry(x) for x in JournalEntry.query.join(Transaction) return [ReportEntry(x) for x in JournalEntry.query.join(Transaction)
.filter(*conditions) .filter(*conditions)
.order_by(Transaction.date, .order_by(Transaction.date,
Transaction.no,
JournalEntry.is_debit.desc(), JournalEntry.is_debit.desc(),
JournalEntry.no) JournalEntry.no)
.options(selectinload(JournalEntry.transaction)).all()] .options(selectinload(JournalEntry.transaction)).all()]

View File

@ -71,6 +71,7 @@ class EntryCollector:
conditions.append(sa.or_(*sub_conditions)) conditions.append(sa.or_(*sub_conditions))
return JournalEntry.query.join(Transaction).filter(*conditions)\ return JournalEntry.query.join(Transaction).filter(*conditions)\
.order_by(Transaction.date, .order_by(Transaction.date,
Transaction.no,
JournalEntry.is_debit, JournalEntry.is_debit,
JournalEntry.no)\ JournalEntry.no)\
.options(selectinload(JournalEntry.account), .options(selectinload(JournalEntry.account),