Revised the constructor of the ReportUrl utility to better deal with the keyword arguments in the accounting application.
This commit is contained in:
parent
ceb6a3454b
commit
23f7564e87
@ -75,12 +75,11 @@ class ReportUrl:
|
|||||||
"""The URL of the accounting reports.
|
"""The URL of the accounting reports.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
**kwargs: the keyword arguments:
|
cash (Account): The currently-specified account of the
|
||||||
period (Period): The currently-specified period.
|
cash account or cash summary.
|
||||||
cash (Account): The currently-specified account of the
|
ledger (Account): The currently-specified account of the
|
||||||
cash account or cash summary.
|
ledger or leger summary.
|
||||||
ledger (Account): The currently-specified account of the
|
period (Period): The currently-specified period.
|
||||||
ledger or leger summary.
|
|
||||||
|
|
||||||
Attributes:
|
Attributes:
|
||||||
cash (str): The URL of the cash account.
|
cash (str): The URL of the cash account.
|
||||||
@ -93,21 +92,14 @@ class ReportUrl:
|
|||||||
balance_sheet (str): The URL of the balance sheet.
|
balance_sheet (str): The URL of the balance sheet.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, cash=None, ledger=None, period=None):
|
||||||
if "period" in kwargs:
|
self._period = Period() if period is None else period
|
||||||
self._period = kwargs["period"]
|
self._cash = Account.objects.get(
|
||||||
else:
|
code=settings.ACCOUNTING["DEFAULT_CASH_ACCOUNT"])\
|
||||||
self._period = Period()
|
if cash is None else cash
|
||||||
if "cash" in kwargs:
|
self._ledger = Account.objects.get(
|
||||||
self._cash = kwargs["cash"]
|
code=settings.ACCOUNTING["DEFAULT_LEDGER_ACCOUNT"])\
|
||||||
else:
|
if ledger is None else ledger
|
||||||
self._cash = Account.objects.get(
|
|
||||||
code=settings.ACCOUNTING["DEFAULT_CASH_ACCOUNT"])
|
|
||||||
if "ledger" in kwargs:
|
|
||||||
self._ledger = kwargs["ledger"]
|
|
||||||
else:
|
|
||||||
self._ledger = Account.objects.get(
|
|
||||||
code=settings.ACCOUNTING["DEFAULT_LEDGER_ACCOUNT"])
|
|
||||||
|
|
||||||
def cash(self):
|
def cash(self):
|
||||||
return reverse(
|
return reverse(
|
||||||
|
Loading…
Reference in New Issue
Block a user