Moved the period and period chooser to the "accounting.report.period" module.

This commit is contained in:
依瑪貓 2023-03-09 18:30:33 +08:00
parent c6d55fad1c
commit 1850f9787e
14 changed files with 32 additions and 17 deletions

View File

@ -23,8 +23,8 @@ from flask import abort
from werkzeug.routing import BaseConverter from werkzeug.routing import BaseConverter
from accounting.models import Account from accounting.models import Account
from accounting.report.period import Period
from .utils.income_expense_account import IncomeExpensesAccount from .utils.income_expense_account import IncomeExpensesAccount
from .utils.period import Period
class PeriodConverter(BaseConverter): class PeriodConverter(BaseConverter):

View File

@ -0,0 +1,21 @@
# The Mia! Accounting Flask Project.
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/3/9
# Copyright (c) 2023 imacat.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""The period utility.
"""
from .period import Period
from .period_chooser import PeriodChooser

View File

@ -26,13 +26,12 @@ from accounting import db
from accounting.locale import gettext from accounting.locale import gettext
from accounting.models import Currency, BaseAccount, Account, Transaction, \ from accounting.models import Currency, BaseAccount, Account, Transaction, \
JournalEntry JournalEntry
from accounting.report.period import Period, PeriodChooser
from accounting.report.utils.base_page_params import BasePageParams from accounting.report.utils.base_page_params import BasePageParams
from accounting.report.utils.base_report import BaseReport from accounting.report.utils.base_report import BaseReport
from accounting.report.utils.csv_export import BaseCSVRow, csv_download, \ from accounting.report.utils.csv_export import BaseCSVRow, csv_download, \
period_spec period_spec
from accounting.report.utils.option_link import OptionLink from accounting.report.utils.option_link import OptionLink
from accounting.report.utils.period import Period
from accounting.report.utils.period_chooser import PeriodChooser
from accounting.report.utils.report_chooser import ReportChooser from accounting.report.utils.report_chooser import ReportChooser
from accounting.report.utils.report_type import ReportType from accounting.report.utils.report_type import ReportType
from accounting.report.utils.urls import ledger_url, balance_sheet_url, \ from accounting.report.utils.urls import ledger_url, balance_sheet_url, \

View File

@ -27,6 +27,7 @@ from sqlalchemy.orm import selectinload
from accounting import db from accounting import db
from accounting.locale import gettext from accounting.locale import gettext
from accounting.models import Currency, Account, Transaction, JournalEntry from accounting.models import Currency, Account, Transaction, JournalEntry
from accounting.report.period import Period, PeriodChooser
from accounting.report.utils.base_page_params import BasePageParams from accounting.report.utils.base_page_params import BasePageParams
from accounting.report.utils.base_report import BaseReport from accounting.report.utils.base_report import BaseReport
from accounting.report.utils.csv_export import BaseCSVRow, csv_download, \ from accounting.report.utils.csv_export import BaseCSVRow, csv_download, \
@ -34,8 +35,6 @@ from accounting.report.utils.csv_export import BaseCSVRow, csv_download, \
from accounting.report.utils.income_expense_account import \ from accounting.report.utils.income_expense_account import \
IncomeExpensesAccount IncomeExpensesAccount
from accounting.report.utils.option_link import OptionLink from accounting.report.utils.option_link import OptionLink
from accounting.report.utils.period import Period
from accounting.report.utils.period_chooser import PeriodChooser
from accounting.report.utils.report_chooser import ReportChooser from accounting.report.utils.report_chooser import ReportChooser
from accounting.report.utils.report_type import ReportType from accounting.report.utils.report_type import ReportType
from accounting.report.utils.urls import income_expenses_url from accounting.report.utils.urls import income_expenses_url

View File

@ -26,13 +26,12 @@ from accounting import db
from accounting.locale import gettext from accounting.locale import gettext
from accounting.models import Currency, BaseAccount, Account, Transaction, \ from accounting.models import Currency, BaseAccount, Account, Transaction, \
JournalEntry JournalEntry
from accounting.report.period import Period, PeriodChooser
from accounting.report.utils.base_page_params import BasePageParams from accounting.report.utils.base_page_params import BasePageParams
from accounting.report.utils.base_report import BaseReport from accounting.report.utils.base_report import BaseReport
from accounting.report.utils.csv_export import BaseCSVRow, csv_download, \ from accounting.report.utils.csv_export import BaseCSVRow, csv_download, \
period_spec period_spec
from accounting.report.utils.option_link import OptionLink from accounting.report.utils.option_link import OptionLink
from accounting.report.utils.period import Period
from accounting.report.utils.period_chooser import PeriodChooser
from accounting.report.utils.report_chooser import ReportChooser from accounting.report.utils.report_chooser import ReportChooser
from accounting.report.utils.report_type import ReportType from accounting.report.utils.report_type import ReportType
from accounting.report.utils.urls import ledger_url, income_statement_url from accounting.report.utils.urls import ledger_url, income_statement_url

View File

@ -26,12 +26,11 @@ from sqlalchemy.orm import selectinload
from accounting.locale import gettext from accounting.locale import gettext
from accounting.models import Currency, Account, Transaction, JournalEntry from accounting.models import Currency, Account, Transaction, JournalEntry
from accounting.report.period import Period, PeriodChooser
from accounting.report.utils.base_page_params import BasePageParams from accounting.report.utils.base_page_params import BasePageParams
from accounting.report.utils.base_report import BaseReport from accounting.report.utils.base_report import BaseReport
from accounting.report.utils.csv_export import BaseCSVRow, csv_download, \ from accounting.report.utils.csv_export import BaseCSVRow, csv_download, \
period_spec period_spec
from accounting.report.utils.period import Period
from accounting.report.utils.period_chooser import PeriodChooser
from accounting.report.utils.report_chooser import ReportChooser from accounting.report.utils.report_chooser import ReportChooser
from accounting.report.utils.report_type import ReportType from accounting.report.utils.report_type import ReportType
from accounting.report.utils.urls import journal_url from accounting.report.utils.urls import journal_url

View File

@ -27,13 +27,12 @@ from sqlalchemy.orm import selectinload
from accounting import db from accounting import db
from accounting.locale import gettext from accounting.locale import gettext
from accounting.models import Currency, Account, Transaction, JournalEntry from accounting.models import Currency, Account, Transaction, JournalEntry
from accounting.report.period import Period, PeriodChooser
from accounting.report.utils.base_page_params import BasePageParams from accounting.report.utils.base_page_params import BasePageParams
from accounting.report.utils.base_report import BaseReport from accounting.report.utils.base_report import BaseReport
from accounting.report.utils.csv_export import BaseCSVRow, csv_download, \ from accounting.report.utils.csv_export import BaseCSVRow, csv_download, \
period_spec period_spec
from accounting.report.utils.option_link import OptionLink from accounting.report.utils.option_link import OptionLink
from accounting.report.utils.period import Period
from accounting.report.utils.period_chooser import PeriodChooser
from accounting.report.utils.report_chooser import ReportChooser from accounting.report.utils.report_chooser import ReportChooser
from accounting.report.utils.report_type import ReportType from accounting.report.utils.report_type import ReportType
from accounting.report.utils.urls import ledger_url from accounting.report.utils.urls import ledger_url

View File

@ -25,13 +25,12 @@ from flask import Response, render_template
from accounting import db from accounting import db
from accounting.locale import gettext from accounting.locale import gettext
from accounting.models import Currency, Account, Transaction, JournalEntry from accounting.models import Currency, Account, Transaction, JournalEntry
from accounting.report.period import Period, PeriodChooser
from accounting.report.utils.base_page_params import BasePageParams from accounting.report.utils.base_page_params import BasePageParams
from accounting.report.utils.base_report import BaseReport from accounting.report.utils.base_report import BaseReport
from accounting.report.utils.csv_export import BaseCSVRow, csv_download, \ from accounting.report.utils.csv_export import BaseCSVRow, csv_download, \
period_spec period_spec
from accounting.report.utils.option_link import OptionLink from accounting.report.utils.option_link import OptionLink
from accounting.report.utils.period import Period
from accounting.report.utils.period_chooser import PeriodChooser
from accounting.report.utils.report_chooser import ReportChooser from accounting.report.utils.report_chooser import ReportChooser
from accounting.report.utils.report_type import ReportType from accounting.report.utils.report_type import ReportType
from accounting.report.utils.urls import ledger_url, trial_balance_url from accounting.report.utils.urls import ledger_url, trial_balance_url

View File

@ -25,7 +25,7 @@ from io import StringIO
from flask import Response from flask import Response
from .period import Period from accounting.report.period import Period
class BaseCSVRow(ABC): class BaseCSVRow(ABC):

View File

@ -28,10 +28,10 @@ from flask_babel import LazyString
from accounting import db from accounting import db
from accounting.locale import gettext from accounting.locale import gettext
from accounting.models import Currency, Account from accounting.models import Currency, Account
from accounting.report.period import Period
from accounting.template_globals import default_currency_code from accounting.template_globals import default_currency_code
from .income_expense_account import IncomeExpensesAccount from .income_expense_account import IncomeExpensesAccount
from .option_link import OptionLink from .option_link import OptionLink
from .period import Period
from .report_type import ReportType from .report_type import ReportType
from .urls import journal_url, ledger_url, income_expenses_url, \ from .urls import journal_url, ledger_url, income_expenses_url, \
trial_balance_url, income_statement_url, balance_sheet_url trial_balance_url, income_statement_url, balance_sheet_url

View File

@ -20,8 +20,8 @@
from flask import url_for from flask import url_for
from accounting.models import Currency, Account from accounting.models import Currency, Account
from accounting.report.period import Period
from .income_expense_account import IncomeExpensesAccount from .income_expense_account import IncomeExpensesAccount
from .period import Period
def journal_url(period: Period) \ def journal_url(period: Period) \

View File

@ -20,12 +20,12 @@
from flask import Blueprint, request, Response from flask import Blueprint, request, Response
from accounting.models import Currency, Account from accounting.models import Currency, Account
from accounting.report.period import Period
from accounting.utils.permission import has_permission, can_view from accounting.utils.permission import has_permission, can_view
from .reports import Journal, Ledger, IncomeExpenses, TrialBalance, \ from .reports import Journal, Ledger, IncomeExpenses, TrialBalance, \
IncomeStatement, BalanceSheet, Search IncomeStatement, BalanceSheet, Search
from .template_filters import format_amount from .template_filters import format_amount
from .utils.income_expense_account import IncomeExpensesAccount from .utils.income_expense_account import IncomeExpensesAccount
from .utils.period import Period
bp: Blueprint = Blueprint("report", __name__) bp: Blueprint = Blueprint("report", __name__)
"""The view blueprint for the reports.""" """The view blueprint for the reports."""