Moved the utilities that are only for the report generators from the "accounting.report" module to the "accounting.report.reports.utils" module.

This commit is contained in:
依瑪貓 2023-03-07 22:33:16 +08:00
parent edb893ecd3
commit f838e7f893
12 changed files with 54 additions and 34 deletions

View File

@ -28,12 +28,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.option_link import OptionLink
from accounting.report.page_params import PageParams
from accounting.report.period import Period from accounting.report.period import Period
from accounting.report.period_choosers import BalanceSheetPeriodChooser from .utils.option_link import OptionLink
from accounting.report.report_chooser import ReportChooser from .utils.page_params import PageParams
from accounting.report.report_type import ReportType from .utils.period_choosers import BalanceSheetPeriodChooser
from .utils.report_chooser import ReportChooser
from .utils.report_type import ReportType
class BalanceSheetAccount: class BalanceSheetAccount:

View File

@ -28,13 +28,13 @@ from flask import url_for, render_template, Response
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.option_link import OptionLink
from accounting.report.page_params import PageParams
from accounting.report.period import Period from accounting.report.period import Period
from accounting.report.period_choosers import IncomeExpensesPeriodChooser
from accounting.report.report_chooser import ReportChooser
from accounting.report.report_type import ReportType
from accounting.utils.pagination import Pagination from accounting.utils.pagination import Pagination
from .utils.option_link import OptionLink
from .utils.page_params import PageParams
from .utils.period_choosers import IncomeExpensesPeriodChooser
from .utils.report_chooser import ReportChooser
from .utils.report_type import ReportType
class Entry: class Entry:

View File

@ -28,12 +28,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.option_link import OptionLink
from accounting.report.page_params import PageParams
from accounting.report.period import Period from accounting.report.period import Period
from accounting.report.period_choosers import IncomeStatementPeriodChooser from .utils.option_link import OptionLink
from accounting.report.report_chooser import ReportChooser from .utils.page_params import PageParams
from accounting.report.report_type import ReportType from .utils.period_choosers import IncomeStatementPeriodChooser
from .utils.report_chooser import ReportChooser
from .utils.report_type import ReportType
class IncomeStatementAccount: class IncomeStatementAccount:

View File

@ -28,12 +28,12 @@ from flask import render_template, Response
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.page_params import PageParams
from accounting.report.period import Period from accounting.report.period import Period
from accounting.report.period_choosers import JournalPeriodChooser
from accounting.report.report_chooser import ReportChooser
from accounting.report.report_type import ReportType
from accounting.utils.pagination import Pagination from accounting.utils.pagination import Pagination
from .utils.page_params import PageParams
from .utils.period_choosers import JournalPeriodChooser
from .utils.report_chooser import ReportChooser
from .utils.report_type import ReportType
class Entry: class Entry:

View File

@ -28,13 +28,13 @@ from flask import url_for, render_template, Response
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.option_link import OptionLink
from accounting.report.page_params import PageParams
from accounting.report.period import Period from accounting.report.period import Period
from accounting.report.period_choosers import LedgerPeriodChooser
from accounting.report.report_chooser import ReportChooser
from accounting.report.report_type import ReportType
from accounting.utils.pagination import Pagination from accounting.utils.pagination import Pagination
from .utils.option_link import OptionLink
from .utils.page_params import PageParams
from .utils.period_choosers import LedgerPeriodChooser
from .utils.report_chooser import ReportChooser
from .utils.report_type import ReportType
class Entry: class Entry:

View File

@ -27,12 +27,12 @@ from flask import url_for, 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.option_link import OptionLink
from accounting.report.page_params import PageParams
from accounting.report.period import Period from accounting.report.period import Period
from accounting.report.period_choosers import TrialBalancePeriodChooser from .utils.option_link import OptionLink
from accounting.report.report_chooser import ReportChooser from .utils.page_params import PageParams
from accounting.report.report_type import ReportType from .utils.period_choosers import TrialBalancePeriodChooser
from .utils.report_chooser import ReportChooser
from .utils.report_type import ReportType
class TrialBalanceAccount: class TrialBalanceAccount:

View File

@ -0,0 +1,19 @@
# The Mia! Accounting Flask Project.
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/3/7
# 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 utilities to generate reports.
"""

View File

@ -17,15 +17,15 @@
"""The page parameters of a report. """The page parameters of a report.
""" """
import typing as t
from abc import ABC, abstractmethod from abc import ABC, abstractmethod
from urllib.parse import urlparse, ParseResult, parse_qsl, urlencode, \ from urllib.parse import urlparse, ParseResult, parse_qsl, urlencode, \
urlunparse urlunparse
from flask import request from flask import request
import typing as t
from accounting.report.report_chooser import ReportChooser
from accounting.utils.txn_types import TransactionType from accounting.utils.txn_types import TransactionType
from .report_chooser import ReportChooser
class PageParams(ABC): class PageParams(ABC):

View File

@ -27,8 +27,9 @@ from datetime import date
from flask import url_for from flask import url_for
from accounting.models import Currency, Account, Transaction from accounting.models import Currency, Account, Transaction
from .period import YearPeriod, Period, ThisMonth, LastMonth, SinceLastMonth, \ from accounting.report.period import YearPeriod, Period, ThisMonth, \
ThisYear, LastYear, Today, Yesterday, TemplatePeriod LastMonth, SinceLastMonth, ThisYear, LastYear, Today, Yesterday, \
TemplatePeriod
class PeriodChooser(ABC): class PeriodChooser(ABC):

View File

@ -29,9 +29,9 @@ 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 .option_link import OptionLink from .option_link import OptionLink
from .period import Period
from .report_type import ReportType from .report_type import ReportType