HOTFIX: Quality checks
* fixes bug due to missing evaluation of compensation validity
This commit is contained in:
parent
e2d2e0317c
commit
6e31dfc00d
@ -481,11 +481,13 @@ class RecordModalForm(BaseModalForm):
|
|||||||
"confirm",
|
"confirm",
|
||||||
msg
|
msg
|
||||||
)
|
)
|
||||||
|
valid = checker.valid
|
||||||
# Special case: Intervention
|
# Special case: Intervention
|
||||||
# Add direct checks for related compensations
|
# Add direct checks for related compensations
|
||||||
if isinstance(self.instance, Intervention):
|
if isinstance(self.instance, Intervention):
|
||||||
self._are_compensations_valid()
|
comps_valid = self._are_compensations_valid()
|
||||||
return super_val and checker.valid
|
valid = valid and comps_valid
|
||||||
|
return super_val and valid
|
||||||
|
|
||||||
def _are_compensations_valid(self):
|
def _are_compensations_valid(self):
|
||||||
""" Runs a special case for intervention-compensations validity
|
""" Runs a special case for intervention-compensations validity
|
||||||
@ -494,13 +496,16 @@ class RecordModalForm(BaseModalForm):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
comps = self.instance.compensations.all()
|
comps = self.instance.compensations.all()
|
||||||
|
comps_valid = True
|
||||||
for comp in comps:
|
for comp in comps:
|
||||||
checker = comp.quality_check()
|
checker = comp.quality_check()
|
||||||
|
comps_valid = comps_valid and checker.valid
|
||||||
for msg in checker.messages:
|
for msg in checker.messages:
|
||||||
self.add_error(
|
self.add_error(
|
||||||
"confirm",
|
"confirm",
|
||||||
f"{comp.identifier}: {msg}"
|
f"{comp.identifier}: {msg}"
|
||||||
)
|
)
|
||||||
|
return comps_valid
|
||||||
|
|
||||||
def save(self):
|
def save(self):
|
||||||
with transaction.atomic():
|
with transaction.atomic():
|
||||||
|
Loading…
Reference in New Issue
Block a user