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

@ -19,19 +19,35 @@
"""
from flask import Blueprint, request, Response
from accounting import db
from accounting.models import Currency, Account
from accounting.report.period import Period, get_period
from accounting.template_globals import default_currency_code
from accounting.utils.permission import has_permission, can_view
from .reports import Journal, Ledger, IncomeExpenses, TrialBalance, \
IncomeStatement, BalanceSheet, Search
from .template_filters import format_amount
from .utils.income_expense_account import IncomeExpensesAccount
from .utils.income_expense_account import IncomeExpensesAccount, \
default_io_account
bp: Blueprint = Blueprint("report", __name__)
"""The view blueprint for the reports."""
bp.add_app_template_filter(format_amount, "accounting_report_format_amount")
@bp.get("", endpoint="default")
@has_permission(can_view)
def get_default_report() -> str | Response:
"""Returns the income and expenses log in the default period.
:return: The income and expenses log in the default period.
"""
return __get_income_expenses_list(
db.session.get(Currency, default_currency_code()),
default_io_account(),
get_period())
@bp.get("journal", endpoint="journal-default")
@has_permission(can_view)
def get_default_journal_list() -> str | Response: