Fix for recorded deduction
* fixes bug where deduction of a recorded intervention could be deleted from the eco account detail view * improves check_for_recorded_instance() logic * improves rendering of detail view on compensation-like objects to highlight missing data
This commit is contained in:
@@ -134,24 +134,21 @@ class BaseForm(forms.Form):
|
||||
Returns:
|
||||
|
||||
"""
|
||||
from intervention.forms.modals.deduction import NewEcoAccountDeductionModalForm, EditEcoAccountDeductionModalForm, \
|
||||
RemoveEcoAccountDeductionModalForm
|
||||
from konova.forms.modals.resubmission_form import ResubmissionModalForm
|
||||
is_none = self.instance is None
|
||||
is_other_data_type = not isinstance(self.instance, BaseObject)
|
||||
is_deduction_form_from_account = isinstance(
|
||||
self,
|
||||
(
|
||||
NewEcoAccountDeductionModalForm,
|
||||
ResubmissionModalForm,
|
||||
EditEcoAccountDeductionModalForm,
|
||||
RemoveEcoAccountDeductionModalForm,
|
||||
)
|
||||
) and isinstance(self.instance, EcoAccount)
|
||||
|
||||
if is_none or is_other_data_type or is_deduction_form_from_account:
|
||||
if is_none or is_other_data_type:
|
||||
# Do nothing
|
||||
return
|
||||
|
||||
if self.instance.is_recorded:
|
||||
self.template = "form/recorded_no_edit.html"
|
||||
self.block_form()
|
||||
|
||||
def block_form(self):
|
||||
"""
|
||||
Overwrites template, providing no actions
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
self.template = "form/recorded_no_edit.html"
|
||||
@@ -83,3 +83,6 @@ class ResubmissionModalForm(BaseModalForm):
|
||||
self.instance.resubmissions.add(self.resubmission)
|
||||
return self.resubmission
|
||||
|
||||
def check_for_recorded_instance(self):
|
||||
# Ignore logic in super() implementation
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user