Revised the IsDebitAccount and IsCreditAccount validators to require the error message, and moved their default error messages to the DebitLineItemForm and CreditLineItemForm forms.

This commit is contained in:
2023-03-22 23:19:52 +08:00
parent 7ccc96bda0
commit 35e05b3708
2 changed files with 20 additions and 22 deletions

View File

@ -413,12 +413,14 @@ class DebitLineItemForm(LineItemForm):
"""The ID of the original line item."""
account_code = StringField(
filters=[strip_text],
validators=[ACCOUNT_REQUIRED,
AccountExists(),
IsDebitAccount(),
SameAccountAsOriginalLineItem(),
KeepAccountWhenHavingOffset(),
NotStartPayableFromDebit()])
validators=[
ACCOUNT_REQUIRED,
AccountExists(),
IsDebitAccount(lazy_gettext(
"This account is not for debit line items.")),
SameAccountAsOriginalLineItem(),
KeepAccountWhenHavingOffset(),
NotStartPayableFromDebit()])
"""The account code."""
description = StringField(filters=[strip_text])
"""The description."""
@ -463,12 +465,14 @@ class CreditLineItemForm(LineItemForm):
"""The ID of the original line item."""
account_code = StringField(
filters=[strip_text],
validators=[ACCOUNT_REQUIRED,
AccountExists(),
IsCreditAccount(),
SameAccountAsOriginalLineItem(),
KeepAccountWhenHavingOffset(),
NotStartReceivableFromCredit()])
validators=[
ACCOUNT_REQUIRED,
AccountExists(),
IsCreditAccount(lazy_gettext(
"This account is not for credit line items.")),
SameAccountAsOriginalLineItem(),
KeepAccountWhenHavingOffset(),
NotStartReceivableFromCredit()])
"""The account code."""
description = StringField(filters=[strip_text])
"""The description."""