Revised the documentation of the views and renamed the *_home() view functions to *_default() in the accounting application.

This commit is contained in:
依瑪貓 2020-07-21 07:54:23 +08:00
parent 7657d5f823
commit 083163347f
2 changed files with 129 additions and 32 deletions

View File

@ -41,35 +41,35 @@ register_converter(TransactionTypeConverter, "txn-type")
app_name = "accounting" app_name = "accounting"
urlpatterns = [ urlpatterns = [
path("", views.home, name="home"), path("", views.home, name="home"),
path("cash", views.cash_home, name="cash.home"), path("cash", views.cash_default, name="cash.home"),
path("cash/<str:subject_code>/<str:period_spec>", path("cash/<str:subject_code>/<str:period_spec>",
views.cash, name="cash"), views.cash, name="cash"),
path("cash-summary", path("cash-summary",
views.cash_summary_home, name="cash-summary.home"), views.cash_summary_default, name="cash-summary.home"),
path("cash-summary/<str:subject_code>", path("cash-summary/<str:subject_code>",
views.cash_summary, name="cash-summary"), views.cash_summary, name="cash-summary"),
path("ledger", path("ledger",
views.ledger_home, name="ledger.home"), views.ledger_default, name="ledger.home"),
path("ledger/<str:subject_code>/<str:period_spec>", path("ledger/<str:subject_code>/<str:period_spec>",
views.ledger, name="ledger"), views.ledger, name="ledger"),
path("ledger-summary", path("ledger-summary",
views.ledger_summary_home, name="ledger-summary.home"), views.ledger_summary_default, name="ledger-summary.home"),
path("ledger-summary/<str:subject_code>", path("ledger-summary/<str:subject_code>",
views.ledger_summary, name="ledger-summary"), views.ledger_summary, name="ledger-summary"),
path("journal", path("journal",
views.journal_home, name="journal.home"), views.journal_default, name="journal.home"),
path("journal/<str:period_spec>", path("journal/<str:period_spec>",
views.journal, name="journal"), views.journal, name="journal"),
path("trial-balance", path("trial-balance",
views.trial_balance_home, name="trial-balance.home"), views.trial_balance_default, name="trial-balance.home"),
path("trial-balance/<str:period_spec>", path("trial-balance/<str:period_spec>",
views.trial_balance, name="trial-balance"), views.trial_balance, name="trial-balance"),
path("income-statement", path("income-statement",
views.income_statement_home, name="income-statement.home"), views.income_statement_default, name="income-statement.home"),
path("income-statement/<str:period_spec>", path("income-statement/<str:period_spec>",
views.income_statement, name="income-statement"), views.income_statement, name="income-statement"),
path("balance-sheet", path("balance-sheet",
views.balance_sheet_home, name="balance-sheet.home"), views.balance_sheet_default, name="balance-sheet.home"),
path("balance-sheet/<str:period_spec>", path("balance-sheet/<str:period_spec>",
views.balance_sheet, name="balance-sheet"), views.balance_sheet, name="balance-sheet"),
path("search", path("search",

View File

@ -43,6 +43,9 @@ from mia_core.utils import Pagination
def home(request): def home(request):
"""The accounting home page. """The accounting home page.
Args:
request (HttpRequest) The request.
Returns: Returns:
HttpResponseRedirect: The redirection to the default HttpResponseRedirect: The redirection to the default
accounting report. accounting report.
@ -52,8 +55,11 @@ def home(request):
@require_GET @require_GET
@digest_login_required @digest_login_required
def cash_home(request): def cash_default(request):
"""The accounting cash report home page. """The default cash account.
Args:
request (HttpRequest) The request.
Returns: Returns:
HttpResponseRedirect: The redirection to the default subject HttpResponseRedirect: The redirection to the default subject
@ -142,7 +148,16 @@ def _find_order_holes(records):
@require_GET @require_GET
@digest_login_required @digest_login_required
def cash(request, subject_code, period_spec): def cash(request, subject_code, period_spec):
"""The cash account report.""" """The cash account.
Args:
request (HttpRequest) The request.
subject_code (str): The code of the specified subject.
period_spec (str): The period specificaiton.
Returns:
HttpResponse: The response.
"""
# The period # The period
period = _get_period(period_spec) period = _get_period(period_spec)
# The subject # The subject
@ -234,8 +249,11 @@ def cash(request, subject_code, period_spec):
@require_GET @require_GET
@digest_login_required @digest_login_required
def cash_summary_home(request): def cash_summary_default(request):
"""The cash summary home page. """The default cash account summary.
Args:
request (HttpRequest) The request.
Returns: Returns:
HttpResponseRedirect: The redirection to the default subject. HttpResponseRedirect: The redirection to the default subject.
@ -245,8 +263,18 @@ def cash_summary_home(request):
reverse("accounting:cash-summary", args=(subject_code))) reverse("accounting:cash-summary", args=(subject_code)))
@require_GET
@digest_login_required
def cash_summary(request, subject_code): def cash_summary(request, subject_code):
"""The cash account summary report.""" """The cash account summary.
Args:
request (HttpRequest) The request.
subject_code (str): The code of the specified subject.
Returns:
HttpResponse: The response.
"""
# The subject # The subject
subjects = _cash_subjects() subjects = _cash_subjects()
current_subject = None current_subject = None
@ -345,8 +373,11 @@ def _ledger_subjects():
@require_GET @require_GET
@digest_login_required @digest_login_required
def ledger_home(request): def ledger_default(request):
"""The ledger home page. """The default ledger.
Args:
request (HttpRequest) The request.
Returns: Returns:
HttpResponseRedirect: The redirection to the default subject HttpResponseRedirect: The redirection to the default subject
@ -361,7 +392,16 @@ def ledger_home(request):
@require_GET @require_GET
@digest_login_required @digest_login_required
def ledger(request, subject_code, period_spec): def ledger(request, subject_code, period_spec):
"""The ledger report.""" """The ledger.
Args:
request (HttpRequest) The request.
subject_code (str): The code of the specified subject.
period_spec (str): The period specificaiton.
Returns:
HttpResponse: The response.
"""
# The period # The period
period = _get_period(period_spec) period = _get_period(period_spec)
# The subject # The subject
@ -418,8 +458,11 @@ def ledger(request, subject_code, period_spec):
@require_GET @require_GET
@digest_login_required @digest_login_required
def ledger_summary_home(request): def ledger_summary_default(request):
"""The ledger summary home page. """The default ledger summary.
Args:
request (HttpRequest) The request.
Returns: Returns:
HttpResponseRedirect: The redirection to the default subject. HttpResponseRedirect: The redirection to the default subject.
@ -429,8 +472,18 @@ def ledger_summary_home(request):
reverse("accounting:ledger-summary", args=(subject_code))) reverse("accounting:ledger-summary", args=(subject_code)))
@require_GET
@digest_login_required
def ledger_summary(request, subject_code): def ledger_summary(request, subject_code):
"""The ledger summary report.""" """The ledger summary report.
Args:
request (HttpRequest) The request.
subject_code (str): The code of the specified subject.
Returns:
HttpResponse: The response.
"""
# The subject # The subject
subjects = _ledger_subjects() subjects = _ledger_subjects()
current_subject = None current_subject = None
@ -478,8 +531,11 @@ def ledger_summary(request, subject_code):
@require_GET @require_GET
@digest_login_required @digest_login_required
def journal_home(request): def journal_default(request):
"""The journal home page. """The default journal.
Args:
request (HttpRequest) The request.
Returns: Returns:
HttpResponseRedirect: The redirection to the default month. HttpResponseRedirect: The redirection to the default month.
@ -492,7 +548,15 @@ def journal_home(request):
@require_GET @require_GET
@digest_login_required @digest_login_required
def journal(request, period_spec): def journal(request, period_spec):
"""The ledger report.""" """The journal.
Args:
request (HttpRequest) The request.
period_spec (str): The period specificaiton.
Returns:
HttpResponse: The response.
"""
# The period # The period
period = _get_period(period_spec) period = _get_period(period_spec)
# The accounting records # The accounting records
@ -552,8 +616,11 @@ def journal(request, period_spec):
@require_GET @require_GET
@digest_login_required @digest_login_required
def trial_balance_home(request): def trial_balance_default(request):
"""The trial balance home page. """The default trial balance.
Args:
request (HttpRequest) The request.
Returns: Returns:
HttpResponseRedirect: The redirection to the default month. HttpResponseRedirect: The redirection to the default month.
@ -566,7 +633,15 @@ def trial_balance_home(request):
@require_GET @require_GET
@digest_login_required @digest_login_required
def trial_balance(request, period_spec): def trial_balance(request, period_spec):
"""The trial blanace.""" """The trial balance.
Args:
request (HttpRequest) The request.
period_spec (str): The period specificaiton.
Returns:
HttpResponse: The response.
"""
# The period # The period
period = _get_period(period_spec) period = _get_period(period_spec)
# The accounts # The accounts
@ -646,8 +721,11 @@ def trial_balance(request, period_spec):
@require_GET @require_GET
@digest_login_required @digest_login_required
def income_statement_home(request): def income_statement_default(request):
"""The income statement home page. """The default income statement.
Args:
request (HttpRequest) The request.
Returns: Returns:
HttpResponseRedirect: The redirection to the default month. HttpResponseRedirect: The redirection to the default month.
@ -660,7 +738,15 @@ def income_statement_home(request):
@require_GET @require_GET
@digest_login_required @digest_login_required
def income_statement(request, period_spec): def income_statement(request, period_spec):
"""The income statement.""" """The income statement.
Args:
request (HttpRequest) The request.
period_spec (str): The period specificaiton.
Returns:
HttpResponse: The response.
"""
# The period # The period
period = _get_period(period_spec) period = _get_period(period_spec)
# The accounts # The accounts
@ -719,8 +805,11 @@ def income_statement(request, period_spec):
@require_GET @require_GET
@digest_login_required @digest_login_required
def balance_sheet_home(request): def balance_sheet_default(request):
"""The balance sheet home page. """The default balance sheet.
Args:
request (HttpRequest) The request.
Returns: Returns:
HttpResponseRedirect: The redirection to the default month. HttpResponseRedirect: The redirection to the default month.
@ -733,7 +822,15 @@ def balance_sheet_home(request):
@require_GET @require_GET
@digest_login_required @digest_login_required
def balance_sheet(request, period_spec): def balance_sheet(request, period_spec):
"""The balance sheet.""" """The balance sheet.
Args:
request (HttpRequest) The request.
period_spec (str): The period specificaiton.
Returns:
HttpResponse: The response.
"""
# The period # The period
period = _get_period(period_spec) period = _get_period(period_spec)
# The accounts # The accounts