#57 Deduction shortcut remove
* removes deduction shortcut * adds missing quality checks on intervention deduction accounts validity * fixes error if checked intervention shall be checked again * adds/updates translations
This commit is contained in:
parent
f1e293977e
commit
498f0a9bbc
@ -58,8 +58,20 @@ class EcoAccountQualityChecker(CompensationQualityChecker):
|
|||||||
self._check_deductable_surface()
|
self._check_deductable_surface()
|
||||||
self._check_responsible_data()
|
self._check_responsible_data()
|
||||||
self._check_legal_data()
|
self._check_legal_data()
|
||||||
|
self._check_record_state()
|
||||||
super().run_check()
|
super().run_check()
|
||||||
|
|
||||||
|
def _check_record_state(self):
|
||||||
|
""" Checks the data quality for recorded state
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
"""
|
||||||
|
if self.obj.recorded is None:
|
||||||
|
self.messages.append(
|
||||||
|
_("Not recorded")
|
||||||
|
)
|
||||||
|
|
||||||
def _check_legal_data(self):
|
def _check_legal_data(self):
|
||||||
""" Checks the data quality for Legal
|
""" Checks the data quality for Legal
|
||||||
|
|
||||||
|
@ -189,27 +189,43 @@ class CheckModalForm(BaseModalForm):
|
|||||||
widget=forms.CheckboxInput(),
|
widget=forms.CheckboxInput(),
|
||||||
required=True
|
required=True
|
||||||
)
|
)
|
||||||
|
valid = None
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
self.form_title = _("Run check")
|
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.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 is_valid(self) -> bool:
|
def _are_deductions_valid(self):
|
||||||
""" Perform a validity check based on quality_check() logic
|
""" Performs validity checks on deductions and their eco-account
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
result (bool)
|
|
||||||
|
"""
|
||||||
|
deductions = self.instance.deductions.all()
|
||||||
|
for deduction in deductions:
|
||||||
|
checker = deduction.account.quality_check()
|
||||||
|
for msg in checker.messages:
|
||||||
|
self.add_error(
|
||||||
|
"checked_comps",
|
||||||
|
f"{deduction.account.identifier}: {msg}"
|
||||||
|
)
|
||||||
|
return checker.valid
|
||||||
|
return True
|
||||||
|
|
||||||
|
def _are_comps_valid(self):
|
||||||
|
""" Performs validity checks on all types of compensations
|
||||||
|
|
||||||
|
Types of compensations are
|
||||||
|
* regular Compensations
|
||||||
|
* deductions from EcoAccounts
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
"""
|
"""
|
||||||
super_result = super().is_valid()
|
|
||||||
# Perform check
|
|
||||||
checker = self.instance.quality_check()
|
|
||||||
for msg in checker.messages:
|
|
||||||
self.add_error(
|
|
||||||
"checked_intervention",
|
|
||||||
msg
|
|
||||||
)
|
|
||||||
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()
|
||||||
for msg in checker.messages:
|
for msg in checker.messages:
|
||||||
@ -217,7 +233,28 @@ class CheckModalForm(BaseModalForm):
|
|||||||
"checked_comps",
|
"checked_comps",
|
||||||
f"{comp.identifier}: {msg}"
|
f"{comp.identifier}: {msg}"
|
||||||
)
|
)
|
||||||
return super_result and checker.valid
|
comps_valid = checker.valid
|
||||||
|
deductions_valid = self._are_deductions_valid()
|
||||||
|
return deductions_valid and comps_valid
|
||||||
|
|
||||||
|
def is_valid(self) -> bool:
|
||||||
|
""" Perform a validity check based on quality_check() logic
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
result (bool)
|
||||||
|
"""
|
||||||
|
super_valid = super().is_valid()
|
||||||
|
# Perform check
|
||||||
|
checker = self.instance.quality_check()
|
||||||
|
for msg in checker.messages:
|
||||||
|
self.add_error(
|
||||||
|
"checked_intervention",
|
||||||
|
msg
|
||||||
|
)
|
||||||
|
all_comps_valid = self._are_comps_valid()
|
||||||
|
intervention_valid = checker.valid
|
||||||
|
|
||||||
|
return super_valid and intervention_valid and all_comps_valid
|
||||||
|
|
||||||
def save(self):
|
def save(self):
|
||||||
""" Saving logic
|
""" Saving logic
|
||||||
|
@ -145,7 +145,8 @@ class Intervention(BaseObject, ShareableObjectMixin, RecordableObjectMixin, Chec
|
|||||||
|
|
||||||
def set_checked(self, user: User) -> UserActionLogEntry:
|
def set_checked(self, user: User) -> UserActionLogEntry:
|
||||||
log_entry = super().set_checked(user)
|
log_entry = super().set_checked(user)
|
||||||
self.add_log_entry_to_compensations(log_entry)
|
if log_entry is not None:
|
||||||
|
self.add_log_entry_to_compensations(log_entry)
|
||||||
return log_entry
|
return log_entry
|
||||||
|
|
||||||
def set_unrecorded(self, user: User):
|
def set_unrecorded(self, user: User):
|
||||||
|
@ -492,6 +492,23 @@ class RecordModalForm(BaseModalForm):
|
|||||||
valid = valid and comps_valid
|
valid = valid and comps_valid
|
||||||
return super_val and valid
|
return super_val and valid
|
||||||
|
|
||||||
|
def _are_deductions_valid(self):
|
||||||
|
""" Performs validity checks on deductions and their eco-account
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
"""
|
||||||
|
deductions = self.instance.deductions.all()
|
||||||
|
for deduction in deductions:
|
||||||
|
checker = deduction.account.quality_check()
|
||||||
|
for msg in checker.messages:
|
||||||
|
self.add_error(
|
||||||
|
"confirm",
|
||||||
|
f"{deduction.account.identifier}: {msg}"
|
||||||
|
)
|
||||||
|
return checker.valid
|
||||||
|
return True
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
@ -508,7 +525,10 @@ class RecordModalForm(BaseModalForm):
|
|||||||
"confirm",
|
"confirm",
|
||||||
f"{comp.identifier}: {msg}"
|
f"{comp.identifier}: {msg}"
|
||||||
)
|
)
|
||||||
return comps_valid
|
|
||||||
|
deductions_valid = self._are_deductions_valid()
|
||||||
|
|
||||||
|
return comps_valid and deductions_valid
|
||||||
|
|
||||||
def save(self):
|
def save(self):
|
||||||
with transaction.atomic():
|
with transaction.atomic():
|
||||||
|
@ -119,18 +119,8 @@
|
|||||||
<button class="btn btn-default">{% fa5_icon 'eye' %} {% trans 'Show' %}</button>
|
<button class="btn btn-default">{% fa5_icon 'eye' %} {% trans 'Show' %}</button>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-12 col-lg">
|
|
||||||
<div class="col-sm">
|
|
||||||
<div class="row my-1">
|
|
||||||
<a href="{% url 'home' %}">
|
|
||||||
<button class="btn btn-default">{% fa5_icon 'magic' %} {% trans 'Deduct' %}</button>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<hr>
|
<hr>
|
||||||
|
Binary file not shown.
@ -19,7 +19,7 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: PACKAGE VERSION\n"
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2022-01-06 12:04+0100\n"
|
"POT-Creation-Date: 2022-01-07 15:32+0100\n"
|
||||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
@ -40,7 +40,7 @@ msgstr "Bis"
|
|||||||
#: analysis/forms.py:47 compensation/forms/forms.py:77
|
#: analysis/forms.py:47 compensation/forms/forms.py:77
|
||||||
#: compensation/templates/compensation/detail/eco_account/view.html:58
|
#: compensation/templates/compensation/detail/eco_account/view.html:58
|
||||||
#: compensation/templates/compensation/report/eco_account/report.html:16
|
#: compensation/templates/compensation/report/eco_account/report.html:16
|
||||||
#: compensation/utils/quality.py:100 ema/templates/ema/detail/view.html:49
|
#: compensation/utils/quality.py:112 ema/templates/ema/detail/view.html:49
|
||||||
#: ema/templates/ema/report/report.html:16 ema/utils/quality.py:26
|
#: ema/templates/ema/report/report.html:16 ema/utils/quality.py:26
|
||||||
#: intervention/forms/forms.py:100
|
#: intervention/forms/forms.py:100
|
||||||
#: intervention/templates/intervention/detail/view.html:56
|
#: intervention/templates/intervention/detail/view.html:56
|
||||||
@ -212,7 +212,7 @@ msgstr "Abbuchungen"
|
|||||||
#: compensation/templates/compensation/detail/eco_account/includes/states-before.html:36
|
#: compensation/templates/compensation/detail/eco_account/includes/states-before.html:36
|
||||||
#: ema/templates/ema/detail/includes/states-after.html:36
|
#: ema/templates/ema/detail/includes/states-after.html:36
|
||||||
#: ema/templates/ema/detail/includes/states-before.html:36
|
#: ema/templates/ema/detail/includes/states-before.html:36
|
||||||
#: intervention/forms/modalForms.py:258
|
#: intervention/forms/modalForms.py:295
|
||||||
msgid "Surface"
|
msgid "Surface"
|
||||||
msgstr "Fläche"
|
msgstr "Fläche"
|
||||||
|
|
||||||
@ -275,7 +275,7 @@ msgid "Type"
|
|||||||
msgstr "Typ"
|
msgstr "Typ"
|
||||||
|
|
||||||
#: analysis/templates/analysis/reports/includes/old_data/amount.html:24
|
#: analysis/templates/analysis/reports/includes/old_data/amount.html:24
|
||||||
#: intervention/forms/modalForms.py:269 intervention/forms/modalForms.py:276
|
#: intervention/forms/modalForms.py:306 intervention/forms/modalForms.py:313
|
||||||
#: intervention/tables.py:88
|
#: intervention/tables.py:88
|
||||||
#: intervention/templates/intervention/detail/view.html:19
|
#: intervention/templates/intervention/detail/view.html:19
|
||||||
#: konova/templates/konova/home.html:11 templates/navbars/navbar.html:22
|
#: konova/templates/konova/home.html:11 templates/navbars/navbar.html:22
|
||||||
@ -285,7 +285,7 @@ msgstr "Eingriff"
|
|||||||
#: analysis/templates/analysis/reports/includes/old_data/amount.html:34
|
#: analysis/templates/analysis/reports/includes/old_data/amount.html:34
|
||||||
#: compensation/tables.py:224
|
#: compensation/tables.py:224
|
||||||
#: compensation/templates/compensation/detail/eco_account/view.html:19
|
#: compensation/templates/compensation/detail/eco_account/view.html:19
|
||||||
#: intervention/forms/modalForms.py:242 intervention/forms/modalForms.py:249
|
#: intervention/forms/modalForms.py:279 intervention/forms/modalForms.py:286
|
||||||
#: konova/templates/konova/home.html:88 templates/navbars/navbar.html:34
|
#: konova/templates/konova/home.html:88 templates/navbars/navbar.html:34
|
||||||
msgid "Eco-account"
|
msgid "Eco-account"
|
||||||
msgstr "Ökokonto"
|
msgstr "Ökokonto"
|
||||||
@ -367,7 +367,7 @@ msgstr "Zusätzlicher Kommentar"
|
|||||||
#: compensation/forms/forms.py:93
|
#: compensation/forms/forms.py:93
|
||||||
#: compensation/templates/compensation/detail/eco_account/view.html:62
|
#: compensation/templates/compensation/detail/eco_account/view.html:62
|
||||||
#: compensation/templates/compensation/report/eco_account/report.html:20
|
#: compensation/templates/compensation/report/eco_account/report.html:20
|
||||||
#: compensation/utils/quality.py:102 ema/templates/ema/detail/view.html:53
|
#: compensation/utils/quality.py:114 ema/templates/ema/detail/view.html:53
|
||||||
#: ema/templates/ema/report/report.html:20 ema/utils/quality.py:28
|
#: ema/templates/ema/report/report.html:20 ema/utils/quality.py:28
|
||||||
#: intervention/forms/forms.py:128
|
#: intervention/forms/forms.py:128
|
||||||
#: intervention/templates/intervention/detail/view.html:60
|
#: intervention/templates/intervention/detail/view.html:60
|
||||||
@ -427,7 +427,7 @@ msgstr "Neue Kompensation"
|
|||||||
msgid "Edit compensation"
|
msgid "Edit compensation"
|
||||||
msgstr "Bearbeite Kompensation"
|
msgstr "Bearbeite Kompensation"
|
||||||
|
|
||||||
#: compensation/forms/forms.py:302 compensation/utils/quality.py:84
|
#: compensation/forms/forms.py:302 compensation/utils/quality.py:96
|
||||||
msgid "Available Surface"
|
msgid "Available Surface"
|
||||||
msgstr "Verfügbare Fläche"
|
msgstr "Verfügbare Fläche"
|
||||||
|
|
||||||
@ -437,7 +437,7 @@ msgstr "Die für Abbuchungen zur Verfügung stehende Menge"
|
|||||||
|
|
||||||
#: compensation/forms/forms.py:314
|
#: compensation/forms/forms.py:314
|
||||||
#: compensation/templates/compensation/detail/eco_account/view.html:66
|
#: compensation/templates/compensation/detail/eco_account/view.html:66
|
||||||
#: compensation/utils/quality.py:72
|
#: compensation/utils/quality.py:84
|
||||||
msgid "Agreement date"
|
msgid "Agreement date"
|
||||||
msgstr "Vereinbarungsdatum"
|
msgstr "Vereinbarungsdatum"
|
||||||
|
|
||||||
@ -492,7 +492,7 @@ msgstr "Biotoptyp"
|
|||||||
msgid "Select the biotope type"
|
msgid "Select the biotope type"
|
||||||
msgstr "Biotoptyp wählen"
|
msgstr "Biotoptyp wählen"
|
||||||
|
|
||||||
#: compensation/forms/modalForms.py:136 intervention/forms/modalForms.py:260
|
#: compensation/forms/modalForms.py:136 intervention/forms/modalForms.py:297
|
||||||
msgid "in m²"
|
msgid "in m²"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@ -1033,17 +1033,21 @@ msgstr "-"
|
|||||||
msgid "States unequal"
|
msgid "States unequal"
|
||||||
msgstr "Ungleiche Zustandsflächenmengen"
|
msgstr "Ungleiche Zustandsflächenmengen"
|
||||||
|
|
||||||
#: compensation/utils/quality.py:74 intervention/utils/quality.py:84
|
#: compensation/utils/quality.py:72
|
||||||
|
msgid "Not recorded"
|
||||||
|
msgstr "Noch nicht verzeichnet"
|
||||||
|
|
||||||
|
#: compensation/utils/quality.py:86 intervention/utils/quality.py:84
|
||||||
msgid "Legal data"
|
msgid "Legal data"
|
||||||
msgstr "Rechtliche Daten"
|
msgstr "Rechtliche Daten"
|
||||||
|
|
||||||
#: compensation/utils/quality.py:88
|
#: compensation/utils/quality.py:100
|
||||||
msgid "Deductable surface can not be larger than state surface"
|
msgid "Deductable surface can not be larger than state surface"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Die abbuchbare Fläche darf die Gesamtfläche der Zielzustände nicht "
|
"Die abbuchbare Fläche darf die Gesamtfläche der Zielzustände nicht "
|
||||||
"überschreiten"
|
"überschreiten"
|
||||||
|
|
||||||
#: compensation/utils/quality.py:104 ema/utils/quality.py:30
|
#: compensation/utils/quality.py:116 ema/utils/quality.py:30
|
||||||
#: intervention/utils/quality.py:55
|
#: intervention/utils/quality.py:55
|
||||||
msgid "Responsible data"
|
msgid "Responsible data"
|
||||||
msgstr "Daten zu den verantwortlichen Stellen"
|
msgstr "Daten zu den verantwortlichen Stellen"
|
||||||
@ -1328,12 +1332,12 @@ msgstr "Eingriffsdaten geprüft"
|
|||||||
msgid "Checked compensations data and payments"
|
msgid "Checked compensations data and payments"
|
||||||
msgstr "Kompensationen und Zahlungen geprüft"
|
msgstr "Kompensationen und Zahlungen geprüft"
|
||||||
|
|
||||||
#: intervention/forms/modalForms.py:195
|
#: intervention/forms/modalForms.py:196
|
||||||
#: intervention/templates/intervention/detail/includes/controls.html:19
|
#: intervention/templates/intervention/detail/includes/controls.html:19
|
||||||
msgid "Run check"
|
msgid "Run check"
|
||||||
msgstr "Prüfung vornehmen"
|
msgstr "Prüfung vornehmen"
|
||||||
|
|
||||||
#: intervention/forms/modalForms.py:196 konova/forms.py:457
|
#: intervention/forms/modalForms.py:197 konova/forms.py:457
|
||||||
msgid ""
|
msgid ""
|
||||||
"I, {} {}, confirm that all necessary control steps have been performed by "
|
"I, {} {}, confirm that all necessary control steps have been performed by "
|
||||||
"myself."
|
"myself."
|
||||||
@ -1341,23 +1345,23 @@ msgstr ""
|
|||||||
"Ich, {} {}, bestätige, dass die notwendigen Kontrollschritte durchgeführt "
|
"Ich, {} {}, bestätige, dass die notwendigen Kontrollschritte durchgeführt "
|
||||||
"wurden:"
|
"wurden:"
|
||||||
|
|
||||||
#: intervention/forms/modalForms.py:244
|
#: intervention/forms/modalForms.py:281
|
||||||
msgid "Only recorded accounts can be selected for deductions"
|
msgid "Only recorded accounts can be selected for deductions"
|
||||||
msgstr "Nur verzeichnete Ökokonten können für Abbuchungen verwendet werden."
|
msgstr "Nur verzeichnete Ökokonten können für Abbuchungen verwendet werden."
|
||||||
|
|
||||||
#: intervention/forms/modalForms.py:271
|
#: intervention/forms/modalForms.py:308
|
||||||
msgid "Only shared interventions can be selected"
|
msgid "Only shared interventions can be selected"
|
||||||
msgstr "Nur freigegebene Eingriffe können gewählt werden"
|
msgstr "Nur freigegebene Eingriffe können gewählt werden"
|
||||||
|
|
||||||
#: intervention/forms/modalForms.py:284
|
#: intervention/forms/modalForms.py:321
|
||||||
msgid "New Deduction"
|
msgid "New Deduction"
|
||||||
msgstr "Neue Abbuchung"
|
msgstr "Neue Abbuchung"
|
||||||
|
|
||||||
#: intervention/forms/modalForms.py:285
|
#: intervention/forms/modalForms.py:322
|
||||||
msgid "Enter the information for a new deduction from a chosen eco-account"
|
msgid "Enter the information for a new deduction from a chosen eco-account"
|
||||||
msgstr "Geben Sie die Informationen für eine neue Abbuchung ein."
|
msgstr "Geben Sie die Informationen für eine neue Abbuchung ein."
|
||||||
|
|
||||||
#: intervention/forms/modalForms.py:313
|
#: intervention/forms/modalForms.py:350
|
||||||
msgid ""
|
msgid ""
|
||||||
"Eco-account {} is not recorded yet. You can only deduct from recorded "
|
"Eco-account {} is not recorded yet. You can only deduct from recorded "
|
||||||
"accounts."
|
"accounts."
|
||||||
@ -1365,7 +1369,7 @@ msgstr ""
|
|||||||
"Ökokonto {} ist noch nicht verzeichnet. Abbuchungen können nur von "
|
"Ökokonto {} ist noch nicht verzeichnet. Abbuchungen können nur von "
|
||||||
"verzeichneten Ökokonten erfolgen."
|
"verzeichneten Ökokonten erfolgen."
|
||||||
|
|
||||||
#: intervention/forms/modalForms.py:326
|
#: intervention/forms/modalForms.py:363
|
||||||
msgid ""
|
msgid ""
|
||||||
"The account {} has not enough surface for a deduction of {} m². There are "
|
"The account {} has not enough surface for a deduction of {} m². There are "
|
||||||
"only {} m² left"
|
"only {} m² left"
|
||||||
@ -1659,10 +1663,6 @@ msgstr "Neu"
|
|||||||
msgid "Show"
|
msgid "Show"
|
||||||
msgstr "Anzeigen"
|
msgstr "Anzeigen"
|
||||||
|
|
||||||
#: konova/templates/konova/home.html:130
|
|
||||||
msgid "Deduct"
|
|
||||||
msgstr "Abbuchen"
|
|
||||||
|
|
||||||
#: konova/templates/konova/includes/parcels.html:3
|
#: konova/templates/konova/includes/parcels.html:3
|
||||||
msgid "Spatial reference"
|
msgid "Spatial reference"
|
||||||
msgstr "Raumreferenz"
|
msgstr "Raumreferenz"
|
||||||
@ -3560,6 +3560,9 @@ msgstr ""
|
|||||||
msgid "Unable to connect to qpid with SASL mechanism %s"
|
msgid "Unable to connect to qpid with SASL mechanism %s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#~ msgid "Deduct"
|
||||||
|
#~ msgstr "Abbuchen"
|
||||||
|
|
||||||
#~ msgid "No file given!"
|
#~ msgid "No file given!"
|
||||||
#~ msgstr "Keine Datei angegeben!"
|
#~ msgstr "Keine Datei angegeben!"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user