Fixed the debit and credit methods of the Account data model, removing the payable accounts that need offset from the debit accounts, and the receivable accounts that need offset from the credit accounts. They should not be selectable.

This commit is contained in:
依瑪貓 2023-03-22 19:54:27 +08:00
parent c885c08c37
commit 10170d613d

View File

@ -275,7 +275,8 @@ class Account(db.Model):
:return: The debit accounts.
"""
return cls.query.filter(sa.or_(cls.base_code.startswith("1"),
cls.base_code.startswith("2"),
sa.and_(cls.base_code.startswith("2"),
sa.not_(cls.is_need_offset)),
cls.base_code.startswith("3"),
cls.base_code.startswith("5"),
cls.base_code.startswith("6"),
@ -295,7 +296,8 @@ class Account(db.Model):
:return: The debit accounts.
"""
return cls.query.filter(sa.or_(cls.base_code.startswith("1"),
return cls.query.filter(sa.or_(sa.and_(cls.base_code.startswith("1"),
sa.not_(cls.is_need_offset)),
cls.base_code.startswith("2"),
cls.base_code.startswith("3"),
cls.base_code.startswith("4"),