Eco Account deduction

* adds deductable_surface to EcoAccount model to provide an easy way to change the deductable amount from an account -> depends on external funding e.g. with AktionBlau or similar
* adds overview of deducted and deductable volume to detail view
* adds check to eco account model, so the deductable_surface can never be larger than the total amount of after_state surface sum
* adds german formating for python logic based number formating
* adds/updates translations
This commit is contained in:
mipel
2021-09-17 13:33:51 +02:00
parent e1ffc53958
commit fbcb2d9afd
5 changed files with 236 additions and 168 deletions

View File

@@ -18,6 +18,7 @@ from compensation.models import EcoAccountDeduction, EcoAccount
from intervention.models import Intervention, Revocation, RevocationDocument
from konova.forms import BaseForm, BaseModalForm
from konova.settings import DEFAULT_LAT, DEFAULT_LON, DEFAULT_ZOOM, ZB_GROUP, ETS_GROUP
from konova.utils.general import format_german_float
from konova.utils.messenger import Messenger
from konova.utils.user_checks import in_group
from organisation.models import Organisation
@@ -545,7 +546,11 @@ class NewDeductionForm(BaseModalForm):
if not is_valid_surface:
self.add_error(
"surface",
_("The account {} has not enough surface for a deduction of {} m². There are only {} m² left").format(acc.identifier, form_surface, rest_surface),
_("The account {} has not enough surface for a deduction of {} m². There are only {} m² left").format(
acc.identifier,
format_german_float(form_surface),
format_german_float(rest_surface),
),
)
return is_valid_surface and super_result