From 40e329d37f6d31f45434e8ca36847163e0b4b2e0 Mon Sep 17 00:00:00 2001 From: imacat Date: Thu, 16 Mar 2023 20:42:32 +0800 Subject: [PATCH] Reordered the validators in the "accounting.transaction.forms.journal_entry" module. --- .../transaction/forms/journal_entry.py | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/accounting/transaction/forms/journal_entry.py b/src/accounting/transaction/forms/journal_entry.py index dfa1ee8..e5969e2 100644 --- a/src/accounting/transaction/forms/journal_entry.py +++ b/src/accounting/transaction/forms/journal_entry.py @@ -46,17 +46,6 @@ class AccountExists: "The account does not exist.")) -class PositiveAmount: - """The validator to check if the amount is positive.""" - - def __call__(self, form: FlaskForm, field: DecimalField) -> None: - if field.data is None: - return - if field.data <= 0: - raise ValidationError(lazy_gettext( - "Please fill in a positive amount.")) - - class IsDebitAccount: """The validator to check if the account is for debit journal entries.""" @@ -85,6 +74,17 @@ class IsCreditAccount: "This account is not for credit entries.")) +class PositiveAmount: + """The validator to check if the amount is positive.""" + + def __call__(self, form: FlaskForm, field: DecimalField) -> None: + if field.data is None: + return + if field.data <= 0: + raise ValidationError(lazy_gettext( + "Please fill in a positive amount.")) + + class JournalEntryForm(FlaskForm): """The base form to create or edit a journal entry.""" eid = IntegerField()