From d5af5de3c1f3c64bbf12ee3f99e105cad8758a20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=9D=E7=91=AA=E8=B2=93?= Date: Thu, 23 Feb 2023 11:32:55 +0800 Subject: [PATCH] Renamed offset to pay-off, to be clear. --- src/accounting/account/commands.py | 8 ++++---- src/accounting/account/forms.py | 6 +++--- src/accounting/account/query.py | 4 ++-- src/accounting/models.py | 4 ++-- src/accounting/templates/accounting/account/detail.html | 4 ++-- .../templates/accounting/account/include/form.html | 6 +++--- src/accounting/templates/accounting/account/list.html | 4 ++-- .../translations/zh_Hant/LC_MESSAGES/accounting.po | 4 ++-- 8 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/accounting/account/commands.py b/src/accounting/account/commands.py index 1634b8d..85ee12e 100644 --- a/src/accounting/account/commands.py +++ b/src/accounting/account/commands.py @@ -30,7 +30,7 @@ from accounting.utils.user import has_user, get_user_pk AccountData = tuple[int, str, int, str, str, str, bool] """The format of the account data, as a list of (ID, base account code, number, -English, Traditional Chinese, Simplified Chinese, is-offset-needed) tuples.""" +English, Traditional Chinese, Simplified Chinese, is-pay-off-needed) tuples.""" def __validate_username(ctx: click.core.Context, param: click.core.Option, @@ -93,10 +93,10 @@ def init_accounts_command(username: str) -> None: data: list[AccountData] = [] for base in bases_to_add: l10n: dict[str, str] = {x.locale: x.title for x in base.l10n} - is_offset_needed: bool = True if re.match("^[12]1[34]", base.code) \ + is_pay_off_needed: bool = True if re.match("^[12]1[34]", base.code) \ else False data.append((get_new_id(), base.code, 1, base.title_l10n, - l10n["zh_Hant"], l10n["zh_Hans"], is_offset_needed)) + l10n["zh_Hant"], l10n["zh_Hans"], is_pay_off_needed)) __add_accounting_accounts(data, creator_pk) click.echo(F"{len(data)} added. Accounting accounts initialized.") @@ -113,7 +113,7 @@ def __add_accounting_accounts(data: list[AccountData], creator_pk: int)\ base_code=x[1], no=x[2], title_l10n=x[3], - is_offset_needed=x[6], + is_pay_off_needed=x[6], created_by_id=creator_pk, updated_by_id=creator_pk) for x in data] diff --git a/src/accounting/account/forms.py b/src/accounting/account/forms.py index 733175e..257fc99 100644 --- a/src/accounting/account/forms.py +++ b/src/accounting/account/forms.py @@ -66,8 +66,8 @@ class AccountForm(FlaskForm): filters=[strip_text], validators=[DataRequired(lazy_gettext("Please fill in the title"))]) """The title.""" - is_offset_needed = BooleanField() - """Whether the the entries of this account need offsets.""" + is_pay_off_needed = BooleanField() + """Whether the the entries of this account need pay-off.""" def populate_obj(self, obj: Account) -> None: """Populates the form data into an account object. @@ -86,7 +86,7 @@ class AccountForm(FlaskForm): .filter(Account.base_code == self.base_code.data)).one() obj.no = 1 if max_no is None else max_no + 1 obj.title = self.title.data - obj.is_offset_needed = self.is_offset_needed.data + obj.is_pay_off_needed = self.is_pay_off_needed.data if is_new: current_user_pk: int = get_current_user_pk() obj.created_by_id = current_user_pk diff --git a/src/accounting/account/query.py b/src/accounting/account/query.py index 8887eb5..d74a6bf 100644 --- a/src/accounting/account/query.py +++ b/src/accounting/account/query.py @@ -47,8 +47,8 @@ def get_account_query() -> list[Account]: Account.title_l10n.contains(k), code.contains(k), Account.id.in_(l10n_matches)] - if k in gettext("Offset needed"): - sub_conditions.append(Account.is_offset_needed) + if k in gettext("Pay-off needed"): + sub_conditions.append(Account.is_pay_off_needed) conditions.append(sa.or_(*sub_conditions)) return Account.query.filter(*conditions)\ diff --git a/src/accounting/models.py b/src/accounting/models.py index 1371574..f92821b 100644 --- a/src/accounting/models.py +++ b/src/accounting/models.py @@ -109,8 +109,8 @@ class Account(db.Model): """The account number under the base account.""" title_l10n = db.Column("title", db.String, nullable=False) """The title.""" - is_offset_needed = db.Column(db.Boolean, nullable=False, default=False) - """Whether the entries of this account need offsets.""" + is_pay_off_needed = db.Column(db.Boolean, nullable=False, default=False) + """Whether the entries of this account need pay-off.""" created_at = db.Column(db.DateTime(timezone=True), nullable=False, server_default=db.func.now()) """The time of creation.""" diff --git a/src/accounting/templates/accounting/account/detail.html b/src/accounting/templates/accounting/account/detail.html index 8ae1d14..52d1fbe 100644 --- a/src/accounting/templates/accounting/account/detail.html +++ b/src/accounting/templates/accounting/account/detail.html @@ -85,9 +85,9 @@ First written: 2023/1/31
{{ obj.title }}
{{ obj.code }}
- {% if obj.is_offset_needed %} + {% if obj.is_pay_off_needed %}
- {{ A_("Offset needed") }} + {{ A_("Pay-off needed") }}
{% endif %}
diff --git a/src/accounting/templates/accounting/account/include/form.html b/src/accounting/templates/accounting/account/include/form.html index 82db75a..9bab329 100644 --- a/src/accounting/templates/accounting/account/include/form.html +++ b/src/accounting/templates/accounting/account/include/form.html @@ -63,9 +63,9 @@ First written: 2023/2/1
- -
diff --git a/src/accounting/templates/accounting/account/list.html b/src/accounting/templates/accounting/account/list.html index e94ee1e..47b7974 100644 --- a/src/accounting/templates/accounting/account/list.html +++ b/src/accounting/templates/accounting/account/list.html @@ -58,8 +58,8 @@ First written: 2023/1/30 {% for item in list %} {{ item }} - {% if item.is_offset_needed %} - {{ A_("Offset needed") }} + {% if item.is_pay_off_needed %} + {{ A_("Pay-off needed") }} {% endif %} {% endfor %} diff --git a/src/accounting/translations/zh_Hant/LC_MESSAGES/accounting.po b/src/accounting/translations/zh_Hant/LC_MESSAGES/accounting.po index d659cc7..dbe0ded 100644 --- a/src/accounting/translations/zh_Hant/LC_MESSAGES/accounting.po +++ b/src/accounting/translations/zh_Hant/LC_MESSAGES/accounting.po @@ -39,7 +39,7 @@ msgstr "請填上標題。" #: src/accounting/account/query.py:50 #: src/accounting/templates/accounting/account/detail.html:90 #: src/accounting/templates/accounting/account/list.html:62 -msgid "Offset needed" +msgid "Pay-off needed" msgstr "逐筆核銷" #: src/accounting/account/views.py:88 @@ -226,7 +226,7 @@ msgid "Title" msgstr "標題" #: src/accounting/templates/accounting/account/include/form.html:68 -msgid "The entries in the account need offsets." +msgid "The entries in the account need pay-off." msgstr "帳目要逐筆核銷。" #: src/accounting/templates/accounting/account/include/form.html:90