EcoAccount fixes
* adds deductable surface field into NewEcoAccountForm directly * removes custom manager for LegalData and ResponsibilityData
This commit is contained in:
parent
31ae3dd430
commit
80bdee5230
@ -284,10 +284,26 @@ class NewEcoAccountForm(AbstractCompensationForm, CompensationResponsibleFormMix
|
|||||||
Inherits from basic AbstractCompensationForm and further form fields from CompensationResponsibleFormMixin
|
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 = [
|
field_order = [
|
||||||
"identifier",
|
"identifier",
|
||||||
"title",
|
"title",
|
||||||
"conservation_office",
|
"conservation_office",
|
||||||
|
"surface",
|
||||||
"conservation_file_number",
|
"conservation_file_number",
|
||||||
"handler",
|
"handler",
|
||||||
"fundings",
|
"fundings",
|
||||||
@ -314,6 +330,7 @@ class NewEcoAccountForm(AbstractCompensationForm, CompensationResponsibleFormMix
|
|||||||
title = self.cleaned_data.get("title", None)
|
title = self.cleaned_data.get("title", None)
|
||||||
fundings = self.cleaned_data.get("fundings", None)
|
fundings = self.cleaned_data.get("fundings", None)
|
||||||
handler = self.cleaned_data.get("handler", 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_office = self.cleaned_data.get("conservation_office", None)
|
||||||
conservation_file_number = self.cleaned_data.get("conservation_file_number", None)
|
conservation_file_number = self.cleaned_data.get("conservation_file_number", None)
|
||||||
comment = self.cleaned_data.get("comment", None)
|
comment = self.cleaned_data.get("comment", None)
|
||||||
@ -337,7 +354,7 @@ class NewEcoAccountForm(AbstractCompensationForm, CompensationResponsibleFormMix
|
|||||||
identifier=identifier,
|
identifier=identifier,
|
||||||
title=title,
|
title=title,
|
||||||
responsible=responsible,
|
responsible=responsible,
|
||||||
deductable_surface=0.00,
|
deductable_surface=surface,
|
||||||
created=action,
|
created=action,
|
||||||
geometry=geometry,
|
geometry=geometry,
|
||||||
comment=comment,
|
comment=comment,
|
||||||
@ -354,30 +371,6 @@ class EditEcoAccountForm(NewEcoAccountForm):
|
|||||||
""" Form for editing eco accounts
|
""" 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):
|
def __init__(self, *args, **kwargs):
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
@ -23,26 +23,3 @@ class InterventionManager(models.Manager):
|
|||||||
).prefetch_related(
|
).prefetch_related(
|
||||||
"users",
|
"users",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class LegalDataManager(models.Manager):
|
|
||||||
""" Holds default db fetch setting for this model type
|
|
||||||
|
|
||||||
"""
|
|
||||||
def get_queryset(self):
|
|
||||||
return super().get_querset().select_related(
|
|
||||||
"process_type",
|
|
||||||
).prefetch_related(
|
|
||||||
"laws"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class ResponsibilityDataManager(models.Manager):
|
|
||||||
""" Holds default db fetch setting for this model type
|
|
||||||
|
|
||||||
"""
|
|
||||||
def get_queryset(self):
|
|
||||||
return super().get_querset().select_related(
|
|
||||||
"registration_office",
|
|
||||||
"conservation_office",
|
|
||||||
)
|
|
||||||
|
@ -15,7 +15,7 @@ from django.utils.translation import gettext_lazy as _
|
|||||||
from codelist.models import KonovaCode
|
from codelist.models import KonovaCode
|
||||||
from codelist.settings import CODELIST_REGISTRATION_OFFICE_ID, CODELIST_CONSERVATION_OFFICE_ID, CODELIST_LAW_ID, \
|
from codelist.settings import CODELIST_REGISTRATION_OFFICE_ID, CODELIST_CONSERVATION_OFFICE_ID, CODELIST_LAW_ID, \
|
||||||
CODELIST_PROCESS_TYPE_ID
|
CODELIST_PROCESS_TYPE_ID
|
||||||
from intervention.managers import InterventionManager, LegalDataManager, ResponsibilityDataManager
|
from intervention.managers import InterventionManager
|
||||||
from konova.models import BaseObject, Geometry, UuidModel, BaseResource, AbstractDocument, \
|
from konova.models import BaseObject, Geometry, UuidModel, BaseResource, AbstractDocument, \
|
||||||
generate_document_file_upload_path
|
generate_document_file_upload_path
|
||||||
from konova.settings import DEFAULT_SRID_RLP, LANIS_LINK_TEMPLATE, LANIS_ZOOM_LUT
|
from konova.settings import DEFAULT_SRID_RLP, LANIS_LINK_TEMPLATE, LANIS_ZOOM_LUT
|
||||||
@ -56,7 +56,6 @@ class ResponsibilityData(UuidModel):
|
|||||||
conservation_file_number = models.CharField(max_length=1000, blank=True, null=True)
|
conservation_file_number = models.CharField(max_length=1000, blank=True, null=True)
|
||||||
handler = models.CharField(max_length=500, null=True, blank=True, help_text="Refers to 'Eingriffsverursacher' or 'Maßnahmenträger'")
|
handler = models.CharField(max_length=500, null=True, blank=True, help_text="Refers to 'Eingriffsverursacher' or 'Maßnahmenträger'")
|
||||||
|
|
||||||
objects = ResponsibilityDataManager()
|
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return "ZB: {} | ETS: {} | Handler: {}".format(
|
return "ZB: {} | ETS: {} | Handler: {}".format(
|
||||||
@ -172,8 +171,6 @@ class LegalData(UuidModel):
|
|||||||
|
|
||||||
revocation = models.OneToOneField(Revocation, null=True, blank=True, help_text="Refers to 'Widerspruch am'", on_delete=models.SET_NULL)
|
revocation = models.OneToOneField(Revocation, null=True, blank=True, help_text="Refers to 'Widerspruch am'", on_delete=models.SET_NULL)
|
||||||
|
|
||||||
objects = LegalDataManager()
|
|
||||||
|
|
||||||
|
|
||||||
class Intervention(BaseObject):
|
class Intervention(BaseObject):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user