Moved the IncomeExpensesAccount data model from the "accounting.report.utils.ie_account" module to the "accounting.utils.ie_account" module.
This commit is contained in:
@ -17,53 +17,10 @@
|
||||
"""The pseudo account for the income and expenses log.
|
||||
|
||||
"""
|
||||
import typing as t
|
||||
|
||||
from flask import current_app
|
||||
|
||||
from accounting.locale import gettext
|
||||
from accounting.models import Account
|
||||
|
||||
|
||||
class IncomeExpensesAccount:
|
||||
"""The pseudo account for the income and expenses log."""
|
||||
CURRENT_AL_CODE: str = "0000-000"
|
||||
"""The account code for the current assets and liabilities."""
|
||||
|
||||
def __init__(self, account: Account | None = None):
|
||||
"""Constructs the pseudo account for the income and expenses log.
|
||||
|
||||
:param account: The actual account.
|
||||
"""
|
||||
self.account: Account | None = account
|
||||
self.id: int = -1 if account is None else account.id
|
||||
"""The ID."""
|
||||
self.code: str = "" if account is None else account.code
|
||||
"""The code."""
|
||||
self.title: str = "" if account is None else account.title
|
||||
"""The title."""
|
||||
self.str: str = "" if account is None else str(account)
|
||||
"""The string representation of the account."""
|
||||
|
||||
def __str__(self) -> str:
|
||||
"""Returns the string representation of the account.
|
||||
|
||||
:return: The string representation of the account.
|
||||
"""
|
||||
return self.str
|
||||
|
||||
@classmethod
|
||||
def current_assets_and_liabilities(cls) -> t.Self:
|
||||
"""Returns the pseudo account for current assets and liabilities.
|
||||
|
||||
:return: The pseudo account for current assets and liabilities.
|
||||
"""
|
||||
account: cls = cls()
|
||||
account.id = 0
|
||||
account.code = cls.CURRENT_AL_CODE
|
||||
account.title = gettext("current assets and liabilities")
|
||||
account.str = account.title
|
||||
return account
|
||||
from accounting.utils.ie_account import IncomeExpensesAccount
|
||||
|
||||
|
||||
def default_ie_account_code() -> str:
|
||||
|
@ -30,7 +30,7 @@ from accounting.locale import gettext
|
||||
from accounting.models import Currency, Account
|
||||
from accounting.report.period import Period, get_period
|
||||
from accounting.template_globals import default_currency_code
|
||||
from .ie_account import IncomeExpensesAccount
|
||||
from accounting.utils.ie_account import IncomeExpensesAccount
|
||||
from .option_link import OptionLink
|
||||
from .report_type import ReportType
|
||||
from .urls import journal_url, ledger_url, income_expenses_url, \
|
||||
|
@ -21,8 +21,9 @@ from flask import url_for
|
||||
|
||||
from accounting.models import Currency, Account
|
||||
from accounting.report.period import Period
|
||||
from accounting.report.utils.ie_account import default_ie_account_code
|
||||
from accounting.template_globals import default_currency_code
|
||||
from .ie_account import IncomeExpensesAccount, default_ie_account_code
|
||||
from accounting.utils.ie_account import IncomeExpensesAccount
|
||||
|
||||
|
||||
def journal_url(period: Period) \
|
||||
|
Reference in New Issue
Block a user