Renamed the "default_currency" option to "default_currency_code".
This commit is contained in:
parent
0ad2ac53dd
commit
b673c7aeaf
@ -208,7 +208,7 @@ class RecurringForm(RecurringItemForm):
|
||||
|
||||
class OptionForm(FlaskForm):
|
||||
"""The form to update the options."""
|
||||
default_currency = StringField(
|
||||
default_currency_code = StringField(
|
||||
filters=[strip_text],
|
||||
validators=[
|
||||
DataRequired(lazy_gettext("Please select the default currency.")),
|
||||
@ -230,7 +230,7 @@ class OptionForm(FlaskForm):
|
||||
:param obj: The currency object.
|
||||
:return: None.
|
||||
"""
|
||||
obj.default_currency = self.default_currency.data
|
||||
obj.default_currency_code = self.default_currency_code.data
|
||||
obj.default_ie_account_code = self.default_ie_account_code.data
|
||||
obj.recurring_data = self.recurring.form.as_data
|
||||
|
||||
|
@ -34,4 +34,4 @@ def default_currency_code() -> str:
|
||||
|
||||
:return: The default currency code.
|
||||
"""
|
||||
return options.default_currency
|
||||
return options.default_currency_code
|
||||
|
@ -43,13 +43,13 @@ First written: 2023/3/22
|
||||
<input type="hidden" name="next" value="{{ request.args.next }}">
|
||||
{% endif %}
|
||||
<div class="form-floating mb-3">
|
||||
<select id="accounting-default-currency" class="form-select {% if form.default_currency.errors %} is-invalid {% endif %}" name="default_currency">
|
||||
<select id="accounting-default-currency" class="form-select {% if form.default_currency_code.errors %} is-invalid {% endif %}" name="default_currency_code">
|
||||
{% for currency in accounting_currency_options() %}
|
||||
<option value="{{ currency.code }}" {% if currency.code == form.default_currency.data %} selected="selected" {% endif %}>{{ currency }}</option>
|
||||
<option value="{{ currency.code }}" {% if currency.code == form.default_currency_code.data %} selected="selected" {% endif %}>{{ currency }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<label class="form-label" for="accounting-default-currency">{{ A_("Default Currency") }}</label>
|
||||
<div id="accounting-default-currency-error" class="invalid-feedback">{% if form.default_currency.errors %}{{ form.default_currency.errors[0] }}{% endif %}</div>
|
||||
<div id="accounting-default-currency-error" class="invalid-feedback">{% if form.default_currency_code.errors %}{{ form.default_currency_code.errors[0] }}{% endif %}</div>
|
||||
</div>
|
||||
|
||||
<div class="form-floating mb-3">
|
||||
|
@ -82,21 +82,21 @@ class Options:
|
||||
"""Whether the options were modified."""
|
||||
|
||||
@property
|
||||
def default_currency(self) -> str:
|
||||
def default_currency_code(self) -> str:
|
||||
"""Returns the default currency code.
|
||||
|
||||
:return: The default currency code.
|
||||
"""
|
||||
return self.__get_option("default_currency", "USD")
|
||||
return self.__get_option("default_currency_code", "USD")
|
||||
|
||||
@default_currency.setter
|
||||
def default_currency(self, value: str) -> None:
|
||||
@default_currency_code.setter
|
||||
def default_currency_code(self, value: str) -> None:
|
||||
"""Sets the default currency code.
|
||||
|
||||
:param value: The default currency code.
|
||||
:return: None.
|
||||
"""
|
||||
self.__set_option("default_currency", value)
|
||||
self.__set_option("default_currency_code", value)
|
||||
|
||||
@property
|
||||
def default_currency_text(self) -> str:
|
||||
@ -104,7 +104,7 @@ class Options:
|
||||
|
||||
:return: The text of the default currency code.
|
||||
"""
|
||||
return str(db.session.get(Currency, self.default_currency))
|
||||
return str(db.session.get(Currency, self.default_currency_code))
|
||||
|
||||
@property
|
||||
def default_ie_account_code(self) -> str:
|
||||
|
Loading…
Reference in New Issue
Block a user