From a42e7d13a22cd6c147520ec7aab28d02c120659a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=9D=E7=91=AA=E8=B2=93?= Date: Tue, 21 Mar 2023 21:13:03 +0800 Subject: [PATCH] Renamed the configuration DEFAULT_CURRENCY, DEFAULT_IE_ACCOUNT, and RECURRING to "ACCOUNTING_DEFAULT_CURRENCY", "ACCOUNTING_DEFAULT_IE_ACCOUNT", and "ACCOUNTING_RECURRING", respectively. --- src/accounting/journal_entry/utils/description_editor.py | 4 ++-- src/accounting/report/utils/ie_account.py | 3 ++- src/accounting/template_globals.py | 2 +- tests/test_site/__init__.py | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/accounting/journal_entry/utils/description_editor.py b/src/accounting/journal_entry/utils/description_editor.py index 7063aa0..7ca8c59 100644 --- a/src/accounting/journal_entry/utils/description_editor.py +++ b/src/accounting/journal_entry/utils/description_editor.py @@ -280,11 +280,11 @@ class DescriptionEditor: :return: None. """ - if "RECURRING" not in current_app.config: + if "ACCOUNTING_RECURRING" not in current_app.config: return data: list[tuple[t.Literal["debit", "credit"], str, str, str]] \ = [x.split("|") - for x in current_app.config["RECURRING"].split(",")] + for x in current_app.config["ACCOUNTING_RECURRING"].split(",")] debit_credit_dict: dict[t.Literal["debit", "credit"], DescriptionDebitCredit] \ = {x.debit_credit: x for x in {self.debit, self.credit}} diff --git a/src/accounting/report/utils/ie_account.py b/src/accounting/report/utils/ie_account.py index 5fb0e18..96c84fd 100644 --- a/src/accounting/report/utils/ie_account.py +++ b/src/accounting/report/utils/ie_account.py @@ -72,7 +72,8 @@ def default_ie_account_code() -> str: :return: The default account code for the income and expenses log. """ with current_app.app_context(): - return current_app.config.get("DEFAULT_IE_ACCOUNT", Account.CASH_CODE) + return current_app.config.get("ACCOUNTING_DEFAULT_IE_ACCOUNT", + Account.CASH_CODE) def default_ie_account() -> IncomeExpensesAccount: diff --git a/src/accounting/template_globals.py b/src/accounting/template_globals.py index ff9169e..b4d69be 100644 --- a/src/accounting/template_globals.py +++ b/src/accounting/template_globals.py @@ -36,4 +36,4 @@ def default_currency_code() -> str: :return: The default currency code. """ with current_app.app_context(): - return current_app.config.get("DEFAULT_CURRENCY", "USD") + return current_app.config.get("ACCOUNTING_DEFAULT_CURRENCY", "USD") diff --git a/tests/test_site/__init__.py b/tests/test_site/__init__.py index fb82e9d..c9a9f35 100644 --- a/tests/test_site/__init__.py +++ b/tests/test_site/__init__.py @@ -50,7 +50,7 @@ def create_app(is_testing: bool = False) -> Flask: "SQLALCHEMY_DATABASE_URI": db_uri, "BABEL_DEFAULT_LOCALE": "en", "ALL_LINGUAS": "zh_Hant|正體中文,en|English,zh_Hans|简体中文", - "RECURRING": ( + "ACCOUNTING_RECURRING": ( "debit|1314-001|Pension|Pension for {last_month_name}," "debit|6262-001|Health insurance" "|Health insurance for {last_month_name},"