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:
parent
ac443bd9eb
commit
bce271ceaa
@ -74,6 +74,10 @@
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% empty %}
|
||||
<div class="alert alert-danger mb-0">
|
||||
{% trans 'Missing' %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
@ -68,6 +68,10 @@
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% empty %}
|
||||
<div class="alert alert-danger mb-0">
|
||||
{% trans 'Missing' %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
@ -68,6 +68,10 @@
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% empty %}
|
||||
<div class="alert alert-danger mb-0">
|
||||
{% trans 'Missing' %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
@ -73,6 +73,10 @@
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% empty %}
|
||||
<div class="alert alert-danger mb-0">
|
||||
{% trans 'Missing' %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
@ -68,6 +68,10 @@
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% empty %}
|
||||
<div class="alert alert-danger mb-0">
|
||||
{% trans 'Missing' %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
@ -68,6 +68,10 @@
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% empty %}
|
||||
<div class="alert alert-danger mb-0">
|
||||
{% trans 'Missing' %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
@ -71,6 +71,10 @@
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% empty %}
|
||||
<div class="alert alert-danger mb-0">
|
||||
{% trans 'Missing' %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
@ -66,6 +66,10 @@
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% empty %}
|
||||
<div class="alert alert-danger mb-0">
|
||||
{% trans 'Missing' %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
@ -66,6 +66,10 @@
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% empty %}
|
||||
<div class="alert alert-danger mb-0">
|
||||
{% trans 'Missing' %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
@ -163,6 +163,10 @@ class NewEcoAccountDeductionModalForm(BaseModalForm):
|
||||
self.cleaned_data["account"].mark_as_edited(self.user, edit_comment=DEDUCTION_ADDED)
|
||||
return deduction
|
||||
|
||||
def check_for_recorded_instance(self):
|
||||
# Ignore super() implementation
|
||||
return
|
||||
|
||||
|
||||
class EditEcoAccountDeductionModalForm(NewEcoAccountDeductionModalForm):
|
||||
deduction = None
|
||||
@ -231,6 +235,16 @@ class EditEcoAccountDeductionModalForm(NewEcoAccountDeductionModalForm):
|
||||
old_account.send_notification_mail_on_deduction_change(data_changes)
|
||||
return deduction
|
||||
|
||||
def check_for_recorded_instance(self):
|
||||
"""
|
||||
Extension to super class base method
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
if self.deduction.intervention.is_recorded:
|
||||
self.block_form()
|
||||
|
||||
|
||||
class RemoveEcoAccountDeductionModalForm(RemoveModalForm):
|
||||
""" Removing modal form for EcoAccountDeduction
|
||||
@ -250,3 +264,7 @@ class RemoveEcoAccountDeductionModalForm(RemoveModalForm):
|
||||
self.deduction.intervention.mark_as_edited(self.user, edit_comment=DEDUCTION_REMOVED)
|
||||
self.deduction.account.mark_as_edited(self.user, edit_comment=DEDUCTION_REMOVED)
|
||||
self.deduction.delete()
|
||||
|
||||
def check_for_recorded_instance(self):
|
||||
if self.deduction.intervention.is_recorded:
|
||||
self.block_form()
|
||||
|
@ -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
|
||||
|
Binary file not shown.
@ -1217,7 +1217,7 @@ msgstr "Keine Flächenmenge für Abbuchungen eingegeben. Bitte bearbeiten."
|
||||
#: intervention/templates/intervention/detail/view.html:100
|
||||
#: intervention/templates/intervention/detail/view.html:104
|
||||
msgid "Missing"
|
||||
msgstr "fehlt"
|
||||
msgstr "Fehlend"
|
||||
|
||||
#: compensation/templates/compensation/detail/eco_account/view.html:71
|
||||
#: ema/templates/ema/detail/view.html:57
|
||||
@ -2210,7 +2210,7 @@ msgstr "{} wurde erfolgreich vom Nutzer {} geprüft! {}"
|
||||
|
||||
#: konova/utils/quality.py:32
|
||||
msgid "missing"
|
||||
msgstr "fehlt"
|
||||
msgstr "fehlend"
|
||||
|
||||
#: konova/views/home.py:78 templates/navbars/navbar.html:16
|
||||
msgid "Home"
|
||||
|
Loading…
Reference in New Issue
Block a user