From e63de9b6281a7ebd2c33d6ba695d4762919fec90 Mon Sep 17 00:00:00 2001 From: mpeltriaux Date: Wed, 13 Sep 2023 14:40:22 +0200 Subject: [PATCH] # Bugfix Payment date invalid * fixes a bug where validation check of payment 'due' has not been triggered properly --- compensation/forms/modals/payment.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/compensation/forms/modals/payment.py b/compensation/forms/modals/payment.py index 0046838c..eed2e702 100644 --- a/compensation/forms/modals/payment.py +++ b/compensation/forms/modals/payment.py @@ -77,8 +77,11 @@ class NewPaymentForm(BaseModalForm): is_valid (bool): True if valid, False otherwise """ super_valid = super().is_valid() - date = self.cleaned_data["due"] - comment = self.cleaned_data["comment"] or None + if not super_valid: + return super_valid + + date = self.cleaned_data.get("due", None) + comment = self.cleaned_data.get("comment", None) if not date and not comment: # At least one needs to be set! self.add_error(