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()