From 90289a0db20fd01326e536d75ea1b4cb4ea83809 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=9D=E7=91=AA=E8=B2=93?= Date: Sun, 5 Mar 2023 22:28:28 +0800 Subject: [PATCH] Fixed the account options to list only the current assets and liabilities for the income and expenses. --- src/accounting/report/reports.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/accounting/report/reports.py b/src/accounting/report/reports.py index 9805aae..31bcec7 100644 --- a/src/accounting/report/reports.py +++ b/src/accounting/report/reports.py @@ -623,7 +623,12 @@ class IncomeExpenses(JournalEntryReport[IncomeExpensesRow]): in_use: set[int] = set(db.session.scalars( sa.select(JournalEntry.account_id) - .filter(JournalEntry.currency_code == self.currency.code) + .join(Account) + .filter(JournalEntry.currency_code == self.currency.code, + sa.or_(Account.base_code.startswith("11"), + Account.base_code.startswith("12"), + Account.base_code.startswith("21"), + Account.base_code.startswith("22"))) .group_by(JournalEntry.account_id)).all()) return [OptionLink(str(x), get_url(x), x.id == self.account.id) for x in Account.query.filter(Account.id.in_(in_use))