Fixed the form validator to enable the selection of Accumulated Profit or Loss accounts other than 3351-001.

This commit is contained in:
依瑪貓 2023-11-28 08:26:37 +08:00
parent dcc9626b23
commit 3f0a0b4227

View File

@ -71,7 +71,7 @@ class IsDebitAccount:
if field.data is None: if field.data is None:
return return
if re.match(r"^(?:[1235689]|7[5678])", field.data) \ if re.match(r"^(?:[1235689]|7[5678])", field.data) \
and not field.data.startswith("3351-") \ and field.data != "3351-001" \
and not field.data.startswith("3353-"): and not field.data.startswith("3353-"):
return return
raise ValidationError(self.__message) raise ValidationError(self.__message)
@ -92,7 +92,7 @@ class IsCreditAccount:
if field.data is None: if field.data is None:
return return
if re.match(r"^(?:[123489]|7[1234])", field.data) \ if re.match(r"^(?:[123489]|7[1234])", field.data) \
and not field.data.startswith("3351-") \ and field.data != "3351-001" \
and not field.data.startswith("3353-"): and not field.data.startswith("3353-"):
return return
raise ValidationError(self.__message) raise ValidationError(self.__message)