Moved the "accounting.transaction.template_globals" module to "accounting.template_globals", for the two template globals will be used in the reports beside the transaction management.
This commit is contained in:
parent
cff3d1b6bd
commit
3ab4eacf9f
@ -62,6 +62,12 @@ def init_app(app: Flask, user_utils: AbstractUserUtils,
|
|||||||
bp.add_app_template_filter(format_amount, "accounting_format_amount")
|
bp.add_app_template_filter(format_amount, "accounting_format_amount")
|
||||||
bp.add_app_template_filter(format_date, "accounting_format_date")
|
bp.add_app_template_filter(format_date, "accounting_format_date")
|
||||||
|
|
||||||
|
from .template_globals import currency_options, default_currency_code
|
||||||
|
bp.add_app_template_global(currency_options,
|
||||||
|
"accounting_currency_options")
|
||||||
|
bp.add_app_template_global(default_currency_code,
|
||||||
|
"accounting_default_currency_code")
|
||||||
|
|
||||||
from . import locale
|
from . import locale
|
||||||
locale.init_app(app, bp)
|
locale.init_app(app, bp)
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ First written: 2023/2/25
|
|||||||
<div class="d-flex justify-content-between mt-2 mb-3">
|
<div class="d-flex justify-content-between mt-2 mb-3">
|
||||||
<div class="form-floating accounting-currency-content">
|
<div class="form-floating accounting-currency-content">
|
||||||
<select id="accounting-currency-{{ currency_index }}-code" class="form-select" name="currency-{{ currency_index }}-code">
|
<select id="accounting-currency-{{ currency_index }}-code" class="form-select" name="currency-{{ currency_index }}-code">
|
||||||
{% for currency in accounting_txn_currency_options() %}
|
{% for currency in accounting_currency_options() %}
|
||||||
<option value="{{ currency.code }}" {% if currency.code == currency_code_data %} selected="selected" {% endif %}>{{ currency }}</option>
|
<option value="{{ currency.code }}" {% if currency.code == currency_code_data %} selected="selected" {% endif %}>{{ currency }}</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</select>
|
</select>
|
||||||
|
@ -38,7 +38,7 @@ First written: 2023/2/25
|
|||||||
{% else %}
|
{% else %}
|
||||||
{% with currency_index = 1,
|
{% with currency_index = 1,
|
||||||
only_one_currency_form = True,
|
only_one_currency_form = True,
|
||||||
currency_code_data = accounting_txn_default_currency_code(),
|
currency_code_data = accounting_default_currency_code(),
|
||||||
debit_total = "-" %}
|
debit_total = "-" %}
|
||||||
{% include "accounting/transaction/expense/include/form-currency-item.html" %}
|
{% include "accounting/transaction/expense/include/form-currency-item.html" %}
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
|
@ -25,7 +25,7 @@ First written: 2023/2/25
|
|||||||
<div class="d-flex justify-content-between mt-2 mb-3">
|
<div class="d-flex justify-content-between mt-2 mb-3">
|
||||||
<div class="form-floating accounting-currency-content">
|
<div class="form-floating accounting-currency-content">
|
||||||
<select id="accounting-currency-{{ currency_index }}-code" class="form-select" name="currency-{{ currency_index }}-code">
|
<select id="accounting-currency-{{ currency_index }}-code" class="form-select" name="currency-{{ currency_index }}-code">
|
||||||
{% for currency in accounting_txn_currency_options() %}
|
{% for currency in accounting_currency_options() %}
|
||||||
<option value="{{ currency.code }}" {% if currency.code == currency_code_data %} selected="selected" {% endif %}>{{ currency }}</option>
|
<option value="{{ currency.code }}" {% if currency.code == currency_code_data %} selected="selected" {% endif %}>{{ currency }}</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</select>
|
</select>
|
||||||
|
@ -38,7 +38,7 @@ First written: 2023/2/25
|
|||||||
{% else %}
|
{% else %}
|
||||||
{% with currency_index = 1,
|
{% with currency_index = 1,
|
||||||
only_one_currency_form = True,
|
only_one_currency_form = True,
|
||||||
currency_code_data = accounting_txn_default_currency_code(),
|
currency_code_data = accounting_default_currency_code(),
|
||||||
credit_total = "-" %}
|
credit_total = "-" %}
|
||||||
{% include "accounting/transaction/income/include/form-currency-item.html" %}
|
{% include "accounting/transaction/income/include/form-currency-item.html" %}
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
|
@ -25,7 +25,7 @@ First written: 2023/2/25
|
|||||||
<div class="d-flex justify-content-between mt-2 mb-3">
|
<div class="d-flex justify-content-between mt-2 mb-3">
|
||||||
<div class="form-floating accounting-currency-content">
|
<div class="form-floating accounting-currency-content">
|
||||||
<select id="accounting-currency-{{ currency_index }}-code" class="form-select" name="currency-{{ currency_index }}-code">
|
<select id="accounting-currency-{{ currency_index }}-code" class="form-select" name="currency-{{ currency_index }}-code">
|
||||||
{% for currency in accounting_txn_currency_options() %}
|
{% for currency in accounting_currency_options() %}
|
||||||
<option value="{{ currency.code }}" {% if currency.code == currency_code_data %} selected="selected" {% endif %}>{{ currency }}</option>
|
<option value="{{ currency.code }}" {% if currency.code == currency_code_data %} selected="selected" {% endif %}>{{ currency }}</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</select>
|
</select>
|
||||||
|
@ -41,7 +41,7 @@ First written: 2023/2/25
|
|||||||
{% else %}
|
{% else %}
|
||||||
{% with currency_index = 1,
|
{% with currency_index = 1,
|
||||||
only_one_currency_form = True,
|
only_one_currency_form = True,
|
||||||
currency_code_data = accounting_txn_default_currency_code(),
|
currency_code_data = accounting_default_currency_code(),
|
||||||
debit_total = "-",
|
debit_total = "-",
|
||||||
credit_total = "-" %}
|
credit_total = "-" %}
|
||||||
{% include "accounting/transaction/transfer/include/form-currency-item.html" %}
|
{% include "accounting/transaction/transfer/include/form-currency-item.html" %}
|
||||||
|
@ -26,7 +26,7 @@ from flask_wtf import FlaskForm
|
|||||||
from accounting.models import Transaction
|
from accounting.models import Transaction
|
||||||
from .forms import TransactionForm, IncomeTransactionForm, \
|
from .forms import TransactionForm, IncomeTransactionForm, \
|
||||||
ExpenseTransactionForm, TransferTransactionForm
|
ExpenseTransactionForm, TransferTransactionForm
|
||||||
from .template_globals import default_currency_code
|
from accounting.template_globals import default_currency_code
|
||||||
|
|
||||||
|
|
||||||
class TransactionType(ABC):
|
class TransactionType(ABC):
|
||||||
|
@ -38,7 +38,6 @@ from .forms import sort_transactions_in, TransactionReorderForm
|
|||||||
from .queries import get_transaction_query
|
from .queries import get_transaction_query
|
||||||
from .template_filters import with_type, to_transfer, format_amount_input, \
|
from .template_filters import with_type, to_transfer, format_amount_input, \
|
||||||
text2html
|
text2html
|
||||||
from .template_globals import currency_options, default_currency_code
|
|
||||||
|
|
||||||
bp: Blueprint = Blueprint("transaction", __name__)
|
bp: Blueprint = Blueprint("transaction", __name__)
|
||||||
"""The view blueprint for the transaction management."""
|
"""The view blueprint for the transaction management."""
|
||||||
@ -47,9 +46,6 @@ bp.add_app_template_filter(to_transfer, "accounting_txn_to_transfer")
|
|||||||
bp.add_app_template_filter(format_amount_input,
|
bp.add_app_template_filter(format_amount_input,
|
||||||
"accounting_txn_format_amount_input")
|
"accounting_txn_format_amount_input")
|
||||||
bp.add_app_template_filter(text2html, "accounting_txn_text2html")
|
bp.add_app_template_filter(text2html, "accounting_txn_text2html")
|
||||||
bp.add_app_template_global(currency_options, "accounting_txn_currency_options")
|
|
||||||
bp.add_app_template_global(default_currency_code,
|
|
||||||
"accounting_txn_default_currency_code")
|
|
||||||
|
|
||||||
|
|
||||||
@bp.get("", endpoint="list")
|
@bp.get("", endpoint="list")
|
||||||
|
Loading…
Reference in New Issue
Block a user