Added the default report view as the income and expenses log with the default currency, default account and default period. Changed the previous default journal links to the current default.

This commit is contained in:
2023-03-09 20:37:39 +08:00
parent ec257a4b57
commit 05ac5158f8
11 changed files with 56 additions and 12 deletions

View File

@ -21,7 +21,9 @@ from flask import url_for
from accounting.models import Currency, Account
from accounting.report.period import Period
from .income_expense_account import IncomeExpensesAccount
from accounting.template_globals import default_currency_code
from .income_expense_account import IncomeExpensesAccount, \
default_io_account_code
def journal_url(period: Period) \
@ -62,6 +64,10 @@ def income_expenses_url(currency: Currency, account: IncomeExpensesAccount,
:param period: The period.
:return: The URL of the income and expenses log.
"""
if currency.code == default_currency_code() \
and account.code == default_io_account_code() \
and period.is_default:
return url_for("accounting.report.default")
if period.is_default:
return url_for("accounting.report.income-expenses-default",
currency=currency, account=account)