Reordered the validators in the "accounting.transaction.forms.journal_entry" module.
This commit is contained in:
parent
23a0721d8d
commit
40e329d37f
@ -46,17 +46,6 @@ class AccountExists:
|
|||||||
"The account does not exist."))
|
"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:
|
class IsDebitAccount:
|
||||||
"""The validator to check if the account is for debit journal entries."""
|
"""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."))
|
"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):
|
class JournalEntryForm(FlaskForm):
|
||||||
"""The base form to create or edit a journal entry."""
|
"""The base form to create or edit a journal entry."""
|
||||||
eid = IntegerField()
|
eid = IntegerField()
|
||||||
|
Loading…
Reference in New Issue
Block a user