EcoAccount fixes

* adds deductable surface field into NewEcoAccountForm directly
* removes custom manager for LegalData and ResponsibilityData
This commit is contained in:
2021-10-20 10:28:01 +02:00
parent 31ae3dd430
commit 80bdee5230
3 changed files with 19 additions and 52 deletions

View File

@@ -284,10 +284,26 @@ class NewEcoAccountForm(AbstractCompensationForm, CompensationResponsibleFormMix
Inherits from basic AbstractCompensationForm and further form fields from CompensationResponsibleFormMixin
"""
surface = forms.DecimalField(
min_value=0.00,
decimal_places=2,
label=_("Available Surface"),
label_suffix="",
required=False,
help_text=_("The amount that can be used for deductions"),
widget=forms.NumberInput(
attrs={
"class": "form-control",
"placeholder": "0,00"
}
)
)
field_order = [
"identifier",
"title",
"conservation_office",
"surface",
"conservation_file_number",
"handler",
"fundings",
@@ -314,6 +330,7 @@ class NewEcoAccountForm(AbstractCompensationForm, CompensationResponsibleFormMix
title = self.cleaned_data.get("title", None)
fundings = self.cleaned_data.get("fundings", None)
handler = self.cleaned_data.get("handler", None)
surface = self.cleaned_data.get("surface", None)
conservation_office = self.cleaned_data.get("conservation_office", None)
conservation_file_number = self.cleaned_data.get("conservation_file_number", None)
comment = self.cleaned_data.get("comment", None)
@@ -337,7 +354,7 @@ class NewEcoAccountForm(AbstractCompensationForm, CompensationResponsibleFormMix
identifier=identifier,
title=title,
responsible=responsible,
deductable_surface=0.00,
deductable_surface=surface,
created=action,
geometry=geometry,
comment=comment,
@@ -354,30 +371,6 @@ class EditEcoAccountForm(NewEcoAccountForm):
""" Form for editing eco accounts
"""
surface = forms.DecimalField(
min_value=0.00,
decimal_places=2,
label=_("Available Surface"),
label_suffix="",
required=False,
help_text=_("The amount that can be used for deductions"),
widget=forms.NumberInput(
attrs={
"class": "form-control",
"placeholder": "0,00"
}
)
)
field_order = [
"identifier",
"title",
"conservation_office",
"surface",
"conservation_file_number",
"handler",
"fundings",
"comment",
]
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)