Added the "accounting.utils.cast" module to cast the things to the expected type in order to supress the warnings from PyCharm.

This commit is contained in:
2023-03-15 01:06:15 +08:00
parent 4c84686395
commit e9d8a8fcd8
7 changed files with 73 additions and 22 deletions

View File

@ -37,6 +37,7 @@ from accounting.report.utils.option_link import OptionLink
from accounting.report.utils.report_chooser import ReportChooser
from accounting.report.utils.report_type import ReportType
from accounting.report.utils.urls import income_expenses_url
from accounting.utils.cast import be
from accounting.utils.pagination import Pagination
@ -120,7 +121,7 @@ class EntryCollector:
else_=-JournalEntry.amount))
select: sa.Select = sa.Select(balance_func)\
.join(Transaction).join(Account)\
.filter(JournalEntry.currency_code == self.__currency.code,
.filter(be(JournalEntry.currency_code == self.__currency.code),
self.__account_condition,
Transaction.date < self.__period.start)
balance: int | None = db.session.scalar(select)
@ -342,7 +343,7 @@ class PageParams(BasePageParams):
self.account.id == 0)]
in_use: sa.Select = sa.Select(JournalEntry.account_id)\
.join(Account)\
.filter(JournalEntry.currency_code == self.currency.code,
.filter(be(JournalEntry.currency_code == self.currency.code),
sa.or_(Account.base_code.startswith("11"),
Account.base_code.startswith("12"),
Account.base_code.startswith("21"),