Fixed and replaced the incorrect class property declaration with the instance property declaration, and replaced unnecessary pseudo properties with instance properties.

This commit is contained in:
2020-08-02 01:04:47 +08:00
parent fda8a2c523
commit 1b89fef01c
4 changed files with 236 additions and 282 deletions

View File

@ -54,9 +54,6 @@ class ReportUrl:
income_statement (str): The URL of the income statement.
balance_sheet (str): The URL of the balance sheet.
"""
_period = None
_cash = None
_ledger = None
def __init__(self, **kwargs):
if "period" in kwargs:
@ -74,37 +71,29 @@ class ReportUrl:
self._ledger = Account.objects.get(
code=settings.ACCOUNTING["DEFAULT_LEDGER_ACCOUNT"])
@property
def cash(self):
return reverse(
"accounting:cash", args=(self._cash, self._period))
@property
def cash_summary(self):
return reverse("accounting:cash-summary", args=(self._cash,))
@property
def ledger(self):
return reverse(
"accounting:ledger", args=(self._ledger, self._period))
@property
def ledger_summary(self):
return reverse("accounting:ledger-summary", args=(self._ledger,))
@property
def journal(self):
return reverse("accounting:journal", args=(self._period,))
@property
def trial_balance(self):
return reverse("accounting:trial-balance", args=(self._period,))
@property
def income_statement(self):
return reverse("accounting:income-statement", args=(self._period,))
@property
def balance_sheet(self):
return reverse("accounting:balance-sheet", args=(self._period,))
@ -118,7 +107,6 @@ class Populator:
Attributes:
user (User): The user in action.
"""
user = None
def __init__(self, user):
self.user = user