Added the is_nominal pseudo property to the Account data model.

This commit is contained in:
依瑪貓 2023-03-18 19:20:50 +08:00
parent 5ceb9f2e83
commit cabe02f7d0

View File

@ -198,6 +198,14 @@ class Account(db.Model):
return return
self.l10n.append(AccountL10n(locale=current_locale, title=value)) self.l10n.append(AccountL10n(locale=current_locale, title=value))
@property
def is_nominal(self) -> bool:
"""Returns whether the account is a nominal account.
:return: True if the account is a nominal account, or False otherwise.
"""
return self.base_code[0] not in {"1", "2", "3"}
@property @property
def query_values(self) -> list[str]: def query_values(self) -> list[str]:
"""Returns the values to be queried. """Returns the values to be queried.