""" The modal form for running a check on interventions and their compensations
"""
checked_intervention=forms.BooleanField(
label=_("Checked intervention data"),
label_suffix="",
widget=forms.CheckboxInput(),
required=True,
)
checked_comps=forms.BooleanField(
label=_("Checked compensations data and payments"),
label_suffix="",
widget=forms.CheckboxInput(),
required=True
)
valid=None
def__init__(self,*args,**kwargs):
super().__init__(*args,**kwargs)
self.form_title=_("Run check")
self.form_caption=_("I, {}{}, confirm that all necessary control steps have been performed by myself.").format(self.user.first_name,self.user.last_name)
self.valid=False
def_are_deductions_valid(self):
""" Performs validity checks on deductions and their eco-account
Returns:
"""
deductions=self.instance.deductions.all()
fordeductionindeductions:
checker=deduction.account.quality_check()
formsginchecker.messages:
self.add_error(
"checked_comps",
f"{deduction.account.identifier}: {msg}"
)
returnchecker.valid
returnTrue
def_are_comps_valid(self):
""" Performs validity checks on all types of compensations