# Bugfix NewCompensationForm

* fixes bug where a form error would trigger a wrong error warning
This commit is contained in:
mpeltriaux committed 2025-11-28 11:53:31 +01:00
1 parent 5e01d7ccda
commit 43846e8d2f
1 file changed
+2 -2
+2 -2
View File
@@ -171,8 +171,8 @@ class NewCompensationForm(AbstractCompensationForm,
def is_valid(self): def is_valid(self):
valid = super().is_valid() valid = super().is_valid()
intervention = self.cleaned_data.get("intervention", None) intervention = self.cleaned_data.get("intervention", None)
valid &= not intervention.is_recorded if intervention.is_recorded:
if not valid: valid &= False
self.add_error( self.add_error(
"intervention", "intervention",
_("This intervention is currently recorded. You cannot add further compensations as long as it is recorded.") _("This intervention is currently recorded. You cannot add further compensations as long as it is recorded.")