diff --git a/konova/forms.py b/konova/forms.py index a2c1c0cc..82d46c8a 100644 --- a/konova/forms.py +++ b/konova/forms.py @@ -481,11 +481,13 @@ class RecordModalForm(BaseModalForm): "confirm", msg ) + valid = checker.valid # Special case: Intervention # Add direct checks for related compensations if isinstance(self.instance, Intervention): - self._are_compensations_valid() - return super_val and checker.valid + comps_valid = self._are_compensations_valid() + valid = valid and comps_valid + return super_val and valid def _are_compensations_valid(self): """ Runs a special case for intervention-compensations validity @@ -494,13 +496,16 @@ class RecordModalForm(BaseModalForm): """ comps = self.instance.compensations.all() + comps_valid = True for comp in comps: checker = comp.quality_check() + comps_valid = comps_valid and checker.valid for msg in checker.messages: self.add_error( "confirm", f"{comp.identifier}: {msg}" ) + return comps_valid def save(self): with transaction.atomic():