From 2805eb0774fb4e6e82333134d76b07a42c45dd10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=9D=E7=91=AA=E8=B2=93?= Date: Fri, 7 Aug 2020 09:42:22 +0800 Subject: [PATCH] Added the report_url template tag in the accounting application. --- accounting/templatetags/accounting.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/accounting/templatetags/accounting.py b/accounting/templatetags/accounting.py index 2eaa574..c5325be 100644 --- a/accounting/templatetags/accounting.py +++ b/accounting/templatetags/accounting.py @@ -22,6 +22,10 @@ import re from django import template +from accounting.models import Account +from accounting.utils import ReportUrl +from mia_core.period import Period + register = template.Library() @@ -40,3 +44,18 @@ def accounting_amount(value): if value < 0: s = "(%s)" % (s) return s + + +@register.simple_tag +def report_url(cash=None, ledger=None, period=None): + """Returns accounting report URL helper. + + Args: + cash (Account): The current cash account. + ledger (Account): The current ledger account. + period (Period): The period. + + Returns: + ReportUrl: The accounting report URL helper. + """ + return ReportUrl(cash=cash, ledger=ledger, period=period)