#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:
2022-01-07 15:41:40 +01:00
parent f1e293977e
commit 498f0a9bbc
7 changed files with 111 additions and 48 deletions

View File

@@ -492,6 +492,23 @@ class RecordModalForm(BaseModalForm):
valid = valid and comps_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):
""" Runs a special case for intervention-compensations validity
@@ -508,7 +525,10 @@ class RecordModalForm(BaseModalForm):
"confirm",
f"{comp.identifier}: {msg}"
)
return comps_valid
deductions_valid = self._are_deductions_valid()
return comps_valid and deductions_valid
def save(self):
with transaction.atomic():

View File

@@ -119,18 +119,8 @@
<button class="btn btn-default">{% fa5_icon 'eye' %} {% trans 'Show' %}</button>
</a>
</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>
<hr>