diff --git a/src/accounting/models.py b/src/accounting/models.py index 68de0e2..839c50f 100644 --- a/src/accounting/models.py +++ b/src/accounting/models.py @@ -141,11 +141,11 @@ class Account(db.Model): entries = db.relationship("JournalEntry", back_populates="account") """The journal entries.""" - CASH = "1111-001" + CASH_CODE = "1111-001" """The code of the cash account,""" - ACCUMULATED_CHANGE = "3351-001" + ACCUMULATED_CHANGE_CODE = "3351-001" """The code of the accumulated-change account,""" - NET_CHANGE = "3353-001" + NET_CHANGE_CODE = "3353-001" """The code of the net-change account,""" def __str__(self) -> str: @@ -265,7 +265,7 @@ class Account(db.Model): :return: The cash account """ - return cls.find_by_code(cls.CASH) + return cls.find_by_code(cls.CASH_CODE) @classmethod def accumulated_change(cls) -> t.Self: @@ -273,7 +273,7 @@ class Account(db.Model): :return: The accumulated-change account """ - return cls.find_by_code(cls.ACCUMULATED_CHANGE) + return cls.find_by_code(cls.ACCUMULATED_CHANGE_CODE) @property def is_modified(self) -> bool: @@ -550,7 +550,7 @@ class Transaction(db.Model): for currency in self.currencies: if len(currency.debit) > 1: return False - if currency.debit[0].account.code != Account.CASH: + if currency.debit[0].account.code != Account.CASH_CODE: return False return True @@ -564,7 +564,7 @@ class Transaction(db.Model): for currency in self.currencies: if len(currency.credit) > 1: return False - if currency.credit[0].account.code != Account.CASH: + if currency.credit[0].account.code != Account.CASH_CODE: return False return True diff --git a/src/accounting/report/reports/balance_sheet.py b/src/accounting/report/reports/balance_sheet.py index 5ea269e..49f1fad 100644 --- a/src/accounting/report/reports/balance_sheet.py +++ b/src/accounting/report/reports/balance_sheet.py @@ -180,7 +180,7 @@ class AccountCollector: url: str = url_for("accounting.report.income-statement", currency=self.__currency, period=self.__period.before) - self.__add_owner_s_equity(Account.ACCUMULATED_CHANGE, amount, url) + self.__add_owner_s_equity(Account.ACCUMULATED_CHANGE_CODE, amount, url) def __query_accumulated(self) -> Decimal | None: """Queries and returns the accumulated profit or loss. @@ -209,7 +209,7 @@ class AccountCollector: amount: Decimal | None = self.__query_currency_period() url: str = url_for("accounting.report.income-statement", currency=self.__currency, period=self.__period) - self.__add_owner_s_equity(Account.NET_CHANGE, amount, url) + self.__add_owner_s_equity(Account.NET_CHANGE_CODE, amount, url) def __query_currency_period(self) -> Decimal | None: """Queries and returns the net income or loss for current period.