#158 is_pik added
* adds model and form mixin for PIK * integrates mixins for compensation, ema and ecoaccount * adds migration files * extends API * extends API test data * adds is_xy fields to compensation, ema and ecoaccount reports * adds is_pik information to detail views * adds/updates translations
This commit is contained in:
parent
8b67df7617
commit
be885306c5
@ -6,6 +6,7 @@
|
||||
"title": "Test_compensation",
|
||||
"is_cef": false,
|
||||
"is_coherence_keeping": false,
|
||||
"is_pik": false,
|
||||
"intervention": "MUST_BE_SET_IN_TEST",
|
||||
"before_states": [
|
||||
],
|
||||
|
@ -5,6 +5,7 @@
|
||||
"properties": {
|
||||
"title": "Test_ecoaccount",
|
||||
"deductable_surface": 10000.0,
|
||||
"is_pik": false,
|
||||
"responsible": {
|
||||
"conservation_office": null,
|
||||
"conservation_file_number": null,
|
||||
|
@ -4,6 +4,7 @@
|
||||
],
|
||||
"properties": {
|
||||
"title": "Test_ema",
|
||||
"is_pik": false,
|
||||
"responsible": {
|
||||
"conservation_office": null,
|
||||
"conservation_file_number": null,
|
||||
|
@ -122,6 +122,7 @@ class APIV1GetTestCase(BaseAPIV1TestCase):
|
||||
props = geojson["properties"]
|
||||
props["is_cef"]
|
||||
props["is_coherence_keeping"]
|
||||
props["is_pik"]
|
||||
props["intervention"]
|
||||
props["intervention"]["id"]
|
||||
props["intervention"]["identifier"]
|
||||
|
@ -46,6 +46,7 @@
|
||||
"title": "TEST_compensation_CHANGED",
|
||||
"is_cef": true,
|
||||
"is_coherence_keeping": true,
|
||||
"is_pik": true,
|
||||
"intervention": "CHANGE_BEFORE_RUN!!!",
|
||||
"before_states": [],
|
||||
"after_states": [],
|
||||
|
@ -45,6 +45,7 @@
|
||||
"properties": {
|
||||
"title": "TEST_account_CHANGED",
|
||||
"deductable_surface": "100000.0",
|
||||
"is_pik": true,
|
||||
"responsible": {
|
||||
"conservation_office": null,
|
||||
"conservation_file_number": "123-TEST",
|
||||
|
@ -52,6 +52,7 @@
|
||||
"detail": "TEST_HANDLER_CHANGED"
|
||||
}
|
||||
},
|
||||
"is_pik": true,
|
||||
"before_states": [],
|
||||
"after_states": [],
|
||||
"actions": [],
|
||||
|
@ -97,6 +97,7 @@ class APIV1UpdateTestCase(BaseAPIV1TestCase):
|
||||
self.assertNotEqual(modified_on, self.compensation.modified)
|
||||
self.assertEqual(put_props["is_cef"], self.compensation.is_cef)
|
||||
self.assertEqual(put_props["is_coherence_keeping"], self.compensation.is_coherence_keeping)
|
||||
self.assertEqual(put_props["is_pik"], self.compensation.is_pik)
|
||||
self.assertEqual(len(put_props["actions"]), self.compensation.actions.count())
|
||||
self.assertEqual(len(put_props["before_states"]), self.compensation.before_states.count())
|
||||
self.assertEqual(len(put_props["after_states"]), self.compensation.after_states.count())
|
||||
|
@ -34,6 +34,7 @@ class CompensationAPISerializerV1(AbstractModelAPISerializerV1, AbstractCompensa
|
||||
def _extend_properties_data(self, entry):
|
||||
self.properties_data["is_cef"] = entry.is_cef
|
||||
self.properties_data["is_coherence_keeping"] = entry.is_coherence_keeping
|
||||
self.properties_data["is_pik"] = entry.is_pik
|
||||
self.properties_data["intervention"] = self.intervention_to_json(entry.intervention)
|
||||
self.properties_data["before_states"] = self._compensation_state_to_json(entry.before_states.all())
|
||||
self.properties_data["after_states"] = self._compensation_state_to_json(entry.after_states.all())
|
||||
@ -113,6 +114,7 @@ class CompensationAPISerializerV1(AbstractModelAPISerializerV1, AbstractCompensa
|
||||
obj.title = properties["title"]
|
||||
obj.is_cef = properties["is_cef"]
|
||||
obj.is_coherence_keeping = properties["is_coherence_keeping"]
|
||||
obj.is_pik = properties.get("is_pik", False)
|
||||
obj = self.set_intervention(obj, properties["intervention"], user)
|
||||
|
||||
obj.geometry.save()
|
||||
@ -149,6 +151,7 @@ class CompensationAPISerializerV1(AbstractModelAPISerializerV1, AbstractCompensa
|
||||
obj.title = properties["title"]
|
||||
obj.is_cef = properties["is_cef"]
|
||||
obj.is_coherence_keeping = properties["is_coherence_keeping"]
|
||||
obj.is_pik = properties.get("is_pik", False)
|
||||
obj.modified = update_action
|
||||
obj.geometry.geom = self._create_geometry_from_json(json_model)
|
||||
obj.geometry.modified = update_action
|
||||
|
@ -25,6 +25,7 @@ class EcoAccountAPISerializerV1(AbstractModelAPISerializerV1,
|
||||
model = EcoAccount
|
||||
|
||||
def _extend_properties_data(self, entry):
|
||||
self.properties_data["is_pik"] = entry.is_pik
|
||||
self.properties_data["deductable_surface"] = entry.deductable_surface
|
||||
self.properties_data["deductable_surface_available"] = entry.deductable_surface - entry.get_deductions_surface()
|
||||
self.properties_data["responsible"] = self._responsible_to_json(entry.responsible)
|
||||
@ -122,6 +123,7 @@ class EcoAccountAPISerializerV1(AbstractModelAPISerializerV1,
|
||||
properties = json_model["properties"]
|
||||
obj.identifier = obj.generate_new_identifier()
|
||||
obj.title = properties["title"]
|
||||
obj.is_pik = properties.get("is_pik", False)
|
||||
|
||||
try:
|
||||
obj.deductable_surface = float(properties["deductable_surface"])
|
||||
@ -169,6 +171,7 @@ class EcoAccountAPISerializerV1(AbstractModelAPISerializerV1,
|
||||
# Fill in data to objects
|
||||
properties = json_model["properties"]
|
||||
obj.title = properties["title"]
|
||||
obj.is_pik = properties.get("is_pik", False)
|
||||
obj.deductable_surface = float(properties["deductable_surface"])
|
||||
obj.modified = update_action
|
||||
obj.geometry.geom = self._create_geometry_from_json(json_model)
|
||||
|
@ -21,6 +21,7 @@ class EmaAPISerializerV1(AbstractModelAPISerializerV1, AbstractCompensationAPISe
|
||||
model = Ema
|
||||
|
||||
def _extend_properties_data(self, entry):
|
||||
self.properties_data["is_pik"] = entry.is_pik
|
||||
self.properties_data["responsible"] = self._responsible_to_json(entry.responsible)
|
||||
self.properties_data["before_states"] = self._compensation_state_to_json(entry.before_states.all())
|
||||
self.properties_data["after_states"] = self._compensation_state_to_json(entry.after_states.all())
|
||||
@ -104,6 +105,7 @@ class EmaAPISerializerV1(AbstractModelAPISerializerV1, AbstractCompensationAPISe
|
||||
properties = json_model["properties"]
|
||||
obj.identifier = obj.generate_new_identifier()
|
||||
obj.title = properties["title"]
|
||||
obj.is_pik = properties.get("is_pik", False)
|
||||
obj = self._set_responsibility(obj, properties["responsible"])
|
||||
|
||||
obj.geometry.save()
|
||||
@ -141,6 +143,7 @@ class EmaAPISerializerV1(AbstractModelAPISerializerV1, AbstractCompensationAPISe
|
||||
# Fill in data to objects
|
||||
properties = json_model["properties"]
|
||||
obj.title = properties["title"]
|
||||
obj.is_pik = properties.get("is_pik", False)
|
||||
obj.modified = update_action
|
||||
obj.geometry.geom = self._create_geometry_from_json(json_model)
|
||||
obj.geometry.modified = update_action
|
||||
|
@ -55,6 +55,7 @@ class CompensationAdmin(AbstractCompensationAdmin):
|
||||
return super().get_fields(request, obj) + [
|
||||
"is_cef",
|
||||
"is_coherence_keeping",
|
||||
"is_pik",
|
||||
"intervention",
|
||||
]
|
||||
|
||||
|
@ -160,7 +160,23 @@ class CoherenceCompensationFormMixin(forms.Form):
|
||||
)
|
||||
|
||||
|
||||
class NewCompensationForm(AbstractCompensationForm, CEFCompensationFormMixin, CoherenceCompensationFormMixin):
|
||||
class PikCompensationFormMixin(forms.Form):
|
||||
""" A form mixin, providing PIK compensation field
|
||||
|
||||
"""
|
||||
is_pik = forms.BooleanField(
|
||||
label_suffix="",
|
||||
label=_("Is PIK"),
|
||||
help_text=_("Optionally: Whether this compensation is a compensation integrated in production?"),
|
||||
required=False,
|
||||
widget=forms.CheckboxInput()
|
||||
)
|
||||
|
||||
|
||||
class NewCompensationForm(AbstractCompensationForm,
|
||||
CEFCompensationFormMixin,
|
||||
CoherenceCompensationFormMixin,
|
||||
PikCompensationFormMixin):
|
||||
""" Form for creating new compensations.
|
||||
|
||||
Can be initialized with an intervention id for preselecting the related intervention.
|
||||
@ -191,6 +207,7 @@ class NewCompensationForm(AbstractCompensationForm, CEFCompensationFormMixin, Co
|
||||
"identifier",
|
||||
"title",
|
||||
"intervention",
|
||||
"is_pik",
|
||||
"is_cef",
|
||||
"is_coherence_keeping",
|
||||
"comment",
|
||||
@ -234,6 +251,7 @@ class NewCompensationForm(AbstractCompensationForm, CEFCompensationFormMixin, Co
|
||||
intervention = self.cleaned_data.get("intervention", None)
|
||||
is_cef = self.cleaned_data.get("is_cef", None)
|
||||
is_coherence_keeping = self.cleaned_data.get("is_coherence_keeping", None)
|
||||
is_pik = self.cleaned_data.get("is_pik", None)
|
||||
comment = self.cleaned_data.get("comment", None)
|
||||
|
||||
# Create log entry
|
||||
@ -249,6 +267,7 @@ class NewCompensationForm(AbstractCompensationForm, CEFCompensationFormMixin, Co
|
||||
created=action,
|
||||
is_cef=is_cef,
|
||||
is_coherence_keeping=is_coherence_keeping,
|
||||
is_pik=is_pik,
|
||||
geometry=geometry,
|
||||
comment=comment,
|
||||
)
|
||||
@ -281,6 +300,7 @@ class EditCompensationForm(NewCompensationForm):
|
||||
"intervention": self.instance.intervention,
|
||||
"is_cef": self.instance.is_cef,
|
||||
"is_coherence_keeping": self.instance.is_coherence_keeping,
|
||||
"is_pik": self.instance.is_pik,
|
||||
"comment": self.instance.comment,
|
||||
}
|
||||
disabled_fields = []
|
||||
@ -297,6 +317,7 @@ class EditCompensationForm(NewCompensationForm):
|
||||
intervention = self.cleaned_data.get("intervention", None)
|
||||
is_cef = self.cleaned_data.get("is_cef", None)
|
||||
is_coherence_keeping = self.cleaned_data.get("is_coherence_keeping", None)
|
||||
is_pik = self.cleaned_data.get("is_pik", None)
|
||||
comment = self.cleaned_data.get("comment", None)
|
||||
|
||||
# Create log entry
|
||||
@ -313,6 +334,7 @@ class EditCompensationForm(NewCompensationForm):
|
||||
self.instance.is_cef = is_cef
|
||||
self.instance.is_coherence_keeping = is_coherence_keeping
|
||||
self.instance.comment = comment
|
||||
self.instance.is_pik = is_pik
|
||||
self.instance.modified = action
|
||||
self.instance.save()
|
||||
|
||||
@ -322,7 +344,7 @@ class EditCompensationForm(NewCompensationForm):
|
||||
return self.instance
|
||||
|
||||
|
||||
class NewEcoAccountForm(AbstractCompensationForm, CompensationResponsibleFormMixin):
|
||||
class NewEcoAccountForm(AbstractCompensationForm, CompensationResponsibleFormMixin, PikCompensationFormMixin):
|
||||
""" Form for creating eco accounts
|
||||
|
||||
Inherits from basic AbstractCompensationForm and further form fields from CompensationResponsibleFormMixin
|
||||
@ -363,6 +385,7 @@ class NewEcoAccountForm(AbstractCompensationForm, CompensationResponsibleFormMix
|
||||
"registration_date",
|
||||
"surface",
|
||||
"conservation_file_number",
|
||||
"is_pik",
|
||||
"handler_type",
|
||||
"handler_detail",
|
||||
"comment",
|
||||
@ -392,6 +415,7 @@ class NewEcoAccountForm(AbstractCompensationForm, CompensationResponsibleFormMix
|
||||
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)
|
||||
is_pik = self.cleaned_data.get("is_pik", None)
|
||||
comment = self.cleaned_data.get("comment", None)
|
||||
|
||||
# Create log entry
|
||||
@ -423,6 +447,7 @@ class NewEcoAccountForm(AbstractCompensationForm, CompensationResponsibleFormMix
|
||||
created=action,
|
||||
geometry=geometry,
|
||||
comment=comment,
|
||||
is_pik=is_pik,
|
||||
legal=legal
|
||||
)
|
||||
acc.share_with_user(user)
|
||||
@ -458,6 +483,7 @@ class EditEcoAccountForm(NewEcoAccountForm):
|
||||
"registration_date": reg_date,
|
||||
"conservation_office": self.instance.responsible.conservation_office,
|
||||
"conservation_file_number": self.instance.responsible.conservation_file_number,
|
||||
"is_pik": self.instance.is_pik,
|
||||
"comment": self.instance.comment,
|
||||
}
|
||||
disabled_fields = []
|
||||
@ -478,6 +504,7 @@ class EditEcoAccountForm(NewEcoAccountForm):
|
||||
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)
|
||||
is_pik = self.cleaned_data.get("is_pik", None)
|
||||
|
||||
# Create log entry
|
||||
action = UserActionLogEntry.get_edited_action(user)
|
||||
@ -503,6 +530,7 @@ class EditEcoAccountForm(NewEcoAccountForm):
|
||||
self.instance.deductable_surface = surface
|
||||
self.instance.geometry = geometry
|
||||
self.instance.comment = comment
|
||||
self.instance.is_pik = is_pik
|
||||
self.instance.modified = action
|
||||
self.instance.save()
|
||||
|
||||
|
23
compensation/migrations/0007_auto_20220531_1245.py
Normal file
23
compensation/migrations/0007_auto_20220531_1245.py
Normal file
@ -0,0 +1,23 @@
|
||||
# Generated by Django 3.1.3 on 2022-05-31 10:45
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('compensation', '0006_ecoaccount_teams'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='compensation',
|
||||
name='is_pik',
|
||||
field=models.BooleanField(blank=True, default=False, help_text="Flag if compensation is a 'Produktonsintegrierte Kompensation'", null=True),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='ecoaccount',
|
||||
name='is_pik',
|
||||
field=models.BooleanField(blank=True, default=False, help_text="Flag if compensation is a 'Produktonsintegrierte Kompensation'", null=True),
|
||||
),
|
||||
]
|
@ -257,7 +257,22 @@ class CoherenceMixin(models.Model):
|
||||
abstract = True
|
||||
|
||||
|
||||
class Compensation(AbstractCompensation, CEFMixin, CoherenceMixin):
|
||||
class PikMixin(models.Model):
|
||||
""" Provides PIK flag as Mixin
|
||||
|
||||
"""
|
||||
is_pik = models.BooleanField(
|
||||
blank=True,
|
||||
null=True,
|
||||
default=False,
|
||||
help_text="Flag if compensation is a 'Produktonsintegrierte Kompensation'"
|
||||
)
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
||||
|
||||
class Compensation(AbstractCompensation, CEFMixin, CoherenceMixin, PikMixin):
|
||||
"""
|
||||
Regular compensation, linked to an intervention
|
||||
"""
|
||||
|
@ -17,14 +17,13 @@ from django.db.models import Sum, QuerySet
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from compensation.managers import EcoAccountManager, EcoAccountDeductionManager
|
||||
from compensation.models.compensation import AbstractCompensation
|
||||
from compensation.models.compensation import AbstractCompensation, PikMixin
|
||||
from compensation.utils.quality import EcoAccountQualityChecker
|
||||
from konova.models import ShareableObjectMixin, RecordableObjectMixin, AbstractDocument, BaseResource, \
|
||||
generate_document_file_upload_path
|
||||
from konova.settings import DEFAULT_SRID_RLP, LANIS_LINK_TEMPLATE
|
||||
|
||||
|
||||
class EcoAccount(AbstractCompensation, ShareableObjectMixin, RecordableObjectMixin):
|
||||
class EcoAccount(AbstractCompensation, ShareableObjectMixin, RecordableObjectMixin, PikMixin):
|
||||
"""
|
||||
An eco account is a kind of 'prepaid' compensation. It can be compared to an account that already has been filled
|
||||
with some kind of currency. From this account one is able to deduct currency for current projects.
|
||||
|
@ -39,6 +39,16 @@
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">{% trans 'Is PIK' %}</th>
|
||||
<td class="align-middle">
|
||||
{% if obj.is_pik %}
|
||||
{% trans 'Yes' %}
|
||||
{% else %}
|
||||
{% trans 'No' %}
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">{% trans 'Is CEF compensation' %}</th>
|
||||
<td class="align-middle">
|
||||
|
@ -70,6 +70,16 @@
|
||||
<th scope="row">{% trans 'Action handler' %}</th>
|
||||
<td class="align-middle">{{obj.responsible.handler|default_if_none:""}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">{% trans 'Is PIK' %}</th>
|
||||
<td class="align-middle">
|
||||
{% if obj.is_pik %}
|
||||
{% trans 'Yes' %}
|
||||
{% else %}
|
||||
{% trans 'No' %}
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">{% trans 'Last modified' %}</th>
|
||||
<td class="align-middle">
|
||||
|
@ -20,6 +20,36 @@
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">{% trans 'Is PIK' %}</th>
|
||||
<td class="align-middle">
|
||||
{% if obj.is_pik %}
|
||||
{% trans 'Yes' %}
|
||||
{% else %}
|
||||
{% trans 'No' %}
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">{% trans 'Is CEF' %}</th>
|
||||
<td class="align-middle">
|
||||
{% if obj.is_cef %}
|
||||
{% trans 'Yes' %}
|
||||
{% else %}
|
||||
{% trans 'No' %}
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">{% trans 'Is coherence keeping' %}</th>
|
||||
<td class="align-middle">
|
||||
{% if obj.is_coherence_keeping %}
|
||||
{% trans 'Yes' %}
|
||||
{% else %}
|
||||
{% trans 'No' %}
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">{% trans 'Last modified' %}</th>
|
||||
<td class="align-middle">
|
||||
|
@ -20,6 +20,16 @@
|
||||
<th scope="row">{% trans 'Conservation office file number' %}</th>
|
||||
<td class="align-middle">{{obj.responsible.conservation_file_number|default_if_none:""}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">{% trans 'Is PIK' %}</th>
|
||||
<td class="align-middle">
|
||||
{% if obj.is_pik %}
|
||||
{% trans 'Yes' %}
|
||||
{% else %}
|
||||
{% trans 'No' %}
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">{% trans 'Deductions for' %}</th>
|
||||
<td class="align-middle">
|
||||
|
11
ema/forms.py
11
ema/forms.py
@ -12,14 +12,15 @@ from django.db import transaction
|
||||
from django.urls import reverse, reverse_lazy
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from compensation.forms.forms import AbstractCompensationForm, CompensationResponsibleFormMixin
|
||||
from compensation.forms.forms import AbstractCompensationForm, CompensationResponsibleFormMixin, \
|
||||
PikCompensationFormMixin
|
||||
from ema.models import Ema, EmaDocument
|
||||
from intervention.models import Responsibility, Handler
|
||||
from konova.forms import SimpleGeomForm, NewDocumentModalForm
|
||||
from user.models import UserActionLogEntry
|
||||
|
||||
|
||||
class NewEmaForm(AbstractCompensationForm, CompensationResponsibleFormMixin):
|
||||
class NewEmaForm(AbstractCompensationForm, CompensationResponsibleFormMixin, PikCompensationFormMixin):
|
||||
""" Form for creating new EMA objects.
|
||||
|
||||
Inherits basic form fields from AbstractCompensationForm and additional from CompensationResponsibleFormMixin.
|
||||
@ -31,6 +32,7 @@ class NewEmaForm(AbstractCompensationForm, CompensationResponsibleFormMixin):
|
||||
"title",
|
||||
"conservation_office",
|
||||
"conservation_file_number",
|
||||
"is_pik",
|
||||
"handler_type",
|
||||
"handler_detail",
|
||||
"comment",
|
||||
@ -58,6 +60,7 @@ class NewEmaForm(AbstractCompensationForm, CompensationResponsibleFormMixin):
|
||||
handler_detail = self.cleaned_data.get("handler_detail", None)
|
||||
conservation_office = self.cleaned_data.get("conservation_office", None)
|
||||
conservation_file_number = self.cleaned_data.get("conservation_file_number", None)
|
||||
is_pik = self.cleaned_data.get("is_pik", None)
|
||||
comment = self.cleaned_data.get("comment", None)
|
||||
|
||||
# Create log entry
|
||||
@ -83,6 +86,7 @@ class NewEmaForm(AbstractCompensationForm, CompensationResponsibleFormMixin):
|
||||
created=action,
|
||||
geometry=geometry,
|
||||
comment=comment,
|
||||
is_pik=is_pik,
|
||||
)
|
||||
|
||||
# Add the creating user to the list of shared users
|
||||
@ -116,6 +120,7 @@ class EditEmaForm(NewEmaForm):
|
||||
"conservation_office": self.instance.responsible.conservation_office,
|
||||
"conservation_file_number": self.instance.responsible.conservation_file_number,
|
||||
"comment": self.instance.comment,
|
||||
"is_pik": self.instance.is_pik,
|
||||
}
|
||||
disabled_fields = []
|
||||
self.load_initial_data(
|
||||
@ -133,6 +138,7 @@ class EditEmaForm(NewEmaForm):
|
||||
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)
|
||||
is_pik = self.cleaned_data.get("is_pik", None)
|
||||
|
||||
# Create log entry
|
||||
action = UserActionLogEntry.get_edited_action(user)
|
||||
@ -152,6 +158,7 @@ class EditEmaForm(NewEmaForm):
|
||||
self.instance.title = title
|
||||
self.instance.geometry = geometry
|
||||
self.instance.comment = comment
|
||||
self.instance.is_pik = is_pik
|
||||
self.instance.modified = action
|
||||
self.instance.save()
|
||||
|
||||
|
18
ema/migrations/0004_ema_is_pik.py
Normal file
18
ema/migrations/0004_ema_is_pik.py
Normal file
@ -0,0 +1,18 @@
|
||||
# Generated by Django 3.1.3 on 2022-05-31 10:45
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('ema', '0003_ema_teams'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='ema',
|
||||
name='is_pik',
|
||||
field=models.BooleanField(blank=True, default=False, help_text="Flag if compensation is a 'Produktonsintegrierte Kompensation'", null=True),
|
||||
),
|
||||
]
|
@ -13,15 +13,14 @@ from django.db.models import QuerySet
|
||||
from django.http import HttpRequest
|
||||
from django.urls import reverse
|
||||
|
||||
from compensation.models import AbstractCompensation
|
||||
from compensation.models import AbstractCompensation, PikMixin
|
||||
from ema.managers import EmaManager
|
||||
from ema.utils.quality import EmaQualityChecker
|
||||
from konova.models import AbstractDocument, generate_document_file_upload_path, RecordableObjectMixin, ShareableObjectMixin
|
||||
from konova.settings import DEFAULT_SRID_RLP, LANIS_LINK_TEMPLATE
|
||||
from konova.utils.message_templates import DATA_UNSHARED_EXPLANATION, DOCUMENT_REMOVED_TEMPLATE
|
||||
|
||||
|
||||
class Ema(AbstractCompensation, ShareableObjectMixin, RecordableObjectMixin):
|
||||
class Ema(AbstractCompensation, ShareableObjectMixin, RecordableObjectMixin, PikMixin):
|
||||
"""
|
||||
EMA = Ersatzzahlungsmaßnahme
|
||||
(compensation actions from payments)
|
||||
|
@ -56,6 +56,16 @@
|
||||
<th scope="row">{% trans 'Action handler' %}</th>
|
||||
<td class="align-middle">{{obj.responsible.handler|default_if_none:""}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">{% trans 'Is PIK' %}</th>
|
||||
<td class="align-middle">
|
||||
{% if obj.is_pik %}
|
||||
{% trans 'Yes' %}
|
||||
{% else %}
|
||||
{% trans 'No' %}
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">{% trans 'Last modified' %}</th>
|
||||
<td class="align-middle">
|
||||
|
@ -20,6 +20,16 @@
|
||||
<th scope="row">{% trans 'Conservation office file number' %}</th>
|
||||
<td class="align-middle">{{obj.responsible.conservation_file_number|default_if_none:""}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">{% trans 'Is PIK' %}</th>
|
||||
<td class="align-middle">
|
||||
{% if obj.is_pik %}
|
||||
{% trans 'Yes' %}
|
||||
{% else %}
|
||||
{% trans 'No' %}
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">{% trans 'Last modified' %}</th>
|
||||
<td class="align-middle">
|
||||
|
Binary file not shown.
@ -26,7 +26,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2022-05-30 11:51+0200\n"
|
||||
"POT-Creation-Date: 2022-05-31 13:05+0200\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
@ -61,7 +61,7 @@ msgid "Select the responsible office"
|
||||
msgstr "Verantwortliche Stelle"
|
||||
|
||||
#: analysis/forms.py:58 compensation/forms/forms.py:88
|
||||
#: compensation/forms/forms.py:118 compensation/forms/forms.py:183
|
||||
#: compensation/forms/forms.py:118 compensation/forms/forms.py:199
|
||||
#: intervention/forms/forms.py:64 intervention/forms/forms.py:81
|
||||
#: intervention/forms/forms.py:97 intervention/forms/forms.py:113
|
||||
#: intervention/forms/forms.py:154 intervention/forms/modalForms.py:49
|
||||
@ -139,7 +139,7 @@ msgstr "Zuständigkeitsbereich"
|
||||
#: analysis/templates/analysis/reports/includes/intervention/compensated_by.html:8
|
||||
#: analysis/templates/analysis/reports/includes/intervention/laws.html:17
|
||||
#: compensation/tables.py:38
|
||||
#: compensation/templates/compensation/detail/compensation/view.html:64
|
||||
#: compensation/templates/compensation/detail/compensation/view.html:74
|
||||
#: intervention/tables.py:38
|
||||
#: intervention/templates/intervention/detail/view.html:68
|
||||
#: user/models/user_action.py:21
|
||||
@ -155,7 +155,7 @@ msgstr "Geprüft"
|
||||
#: analysis/templates/analysis/reports/includes/intervention/laws.html:20
|
||||
#: analysis/templates/analysis/reports/includes/old_data/amount.html:18
|
||||
#: compensation/tables.py:44 compensation/tables.py:219
|
||||
#: compensation/templates/compensation/detail/compensation/view.html:83
|
||||
#: compensation/templates/compensation/detail/compensation/view.html:93
|
||||
#: compensation/templates/compensation/detail/eco_account/includes/deductions.html:31
|
||||
#: compensation/templates/compensation/detail/eco_account/view.html:45
|
||||
#: ema/tables.py:44 ema/templates/ema/detail/view.html:35
|
||||
@ -350,7 +350,7 @@ msgstr "Bezeichnung"
|
||||
msgid "An explanatory name"
|
||||
msgstr "Aussagekräftiger Titel"
|
||||
|
||||
#: compensation/forms/forms.py:50 ema/forms.py:50 ema/forms.py:108
|
||||
#: compensation/forms/forms.py:50 ema/forms.py:52 ema/forms.py:112
|
||||
msgid "Compensation XY; Location ABC"
|
||||
msgstr "Kompensation XY; Flur ABC"
|
||||
|
||||
@ -431,51 +431,64 @@ msgid ""
|
||||
"Optionally: Whether this compensation is a coherence keeping compensation?"
|
||||
msgstr "Optional: Handelt es sich um eine Kohärenzsicherungsmaßnahme?"
|
||||
|
||||
#: compensation/forms/forms.py:174
|
||||
#: compensation/forms/forms.py:169
|
||||
#: compensation/templates/compensation/detail/compensation/view.html:44
|
||||
#: compensation/templates/compensation/detail/eco_account/view.html:75
|
||||
#: ema/templates/ema/detail/view.html:61
|
||||
msgid "Is PIK"
|
||||
msgstr "Ist PIK Maßnahme"
|
||||
|
||||
#: compensation/forms/forms.py:170
|
||||
msgid ""
|
||||
"Optionally: Whether this compensation is a compensation integrated in "
|
||||
"production?"
|
||||
msgstr "Optional: Handelt es sich um eine produktionsintegrierte Kompensation?"
|
||||
|
||||
#: compensation/forms/forms.py:190
|
||||
#: compensation/templates/compensation/detail/compensation/view.html:36
|
||||
#: compensation/templates/compensation/report/compensation/report.html:16
|
||||
msgid "compensates intervention"
|
||||
msgstr "kompensiert Eingriff"
|
||||
|
||||
#: compensation/forms/forms.py:176
|
||||
#: compensation/forms/forms.py:192
|
||||
msgid "Select the intervention for which this compensation compensates"
|
||||
msgstr "Wählen Sie den Eingriff, für den diese Kompensation bestimmt ist"
|
||||
|
||||
#: compensation/forms/forms.py:202 compensation/views/compensation.py:110
|
||||
#: compensation/forms/forms.py:219 compensation/views/compensation.py:110
|
||||
msgid "New compensation"
|
||||
msgstr "Neue Kompensation"
|
||||
|
||||
#: compensation/forms/forms.py:273
|
||||
#: compensation/forms/forms.py:292
|
||||
msgid "Edit compensation"
|
||||
msgstr "Bearbeite Kompensation"
|
||||
|
||||
#: compensation/forms/forms.py:334 compensation/utils/quality.py:84
|
||||
#: compensation/forms/forms.py:356 compensation/utils/quality.py:84
|
||||
msgid "Available Surface"
|
||||
msgstr "Verfügbare Fläche"
|
||||
|
||||
#: compensation/forms/forms.py:337
|
||||
#: compensation/forms/forms.py:359
|
||||
msgid "The amount that can be used for deductions"
|
||||
msgstr "Die für Abbuchungen zur Verfügung stehende Menge"
|
||||
|
||||
#: compensation/forms/forms.py:346
|
||||
#: compensation/forms/forms.py:368
|
||||
#: compensation/templates/compensation/detail/eco_account/view.html:67
|
||||
#: compensation/utils/quality.py:72
|
||||
msgid "Agreement date"
|
||||
msgstr "Vereinbarungsdatum"
|
||||
|
||||
#: compensation/forms/forms.py:348
|
||||
#: compensation/forms/forms.py:370
|
||||
msgid "When did the parties agree on this?"
|
||||
msgstr "Wann wurde dieses Ökokonto offiziell vereinbart?"
|
||||
|
||||
#: compensation/forms/forms.py:373 compensation/views/eco_account.py:108
|
||||
#: compensation/forms/forms.py:396 compensation/views/eco_account.py:108
|
||||
msgid "New Eco-Account"
|
||||
msgstr "Neues Ökokonto"
|
||||
|
||||
#: compensation/forms/forms.py:382
|
||||
#: compensation/forms/forms.py:405
|
||||
msgid "Eco-Account XY; Location ABC"
|
||||
msgstr "Ökokonto XY; Flur ABC"
|
||||
|
||||
#: compensation/forms/forms.py:442
|
||||
#: compensation/forms/forms.py:467
|
||||
msgid "Edit Eco-Account"
|
||||
msgstr "Ökokonto bearbeiten"
|
||||
|
||||
@ -696,7 +709,7 @@ msgid "Open {}"
|
||||
msgstr "Öffne {}"
|
||||
|
||||
#: compensation/tables.py:163
|
||||
#: compensation/templates/compensation/detail/compensation/view.html:86
|
||||
#: compensation/templates/compensation/detail/compensation/view.html:96
|
||||
#: compensation/templates/compensation/detail/eco_account/includes/deductions.html:58
|
||||
#: compensation/templates/compensation/detail/eco_account/view.html:48
|
||||
#: ema/tables.py:130 ema/templates/ema/detail/view.html:38
|
||||
@ -955,33 +968,39 @@ msgstr "Neuen Ausgangszustand hinzufügen"
|
||||
msgid "Missing surfaces according to states after: "
|
||||
msgstr "Fehlende Flächenmengen laut Zielzustand: "
|
||||
|
||||
#: compensation/templates/compensation/detail/compensation/view.html:44
|
||||
msgid "Is CEF compensation"
|
||||
msgstr "Ist CEF Maßnahme"
|
||||
|
||||
#: compensation/templates/compensation/detail/compensation/view.html:47
|
||||
#: compensation/templates/compensation/detail/compensation/view.html:57
|
||||
#: compensation/templates/compensation/detail/compensation/view.html:67
|
||||
#: compensation/templates/compensation/detail/eco_account/view.html:78
|
||||
#: ema/templates/ema/detail/view.html:64
|
||||
#: venv/lib/python3.7/site-packages/django/forms/widgets.py:710
|
||||
msgid "Yes"
|
||||
msgstr "Ja"
|
||||
|
||||
#: compensation/templates/compensation/detail/compensation/view.html:49
|
||||
#: compensation/templates/compensation/detail/compensation/view.html:59
|
||||
#: compensation/templates/compensation/detail/compensation/view.html:69
|
||||
#: compensation/templates/compensation/detail/eco_account/view.html:80
|
||||
#: ema/templates/ema/detail/view.html:66
|
||||
#: venv/lib/python3.7/site-packages/django/forms/widgets.py:711
|
||||
msgid "No"
|
||||
msgstr "Nein"
|
||||
|
||||
#: compensation/templates/compensation/detail/compensation/view.html:54
|
||||
msgid "Is CEF compensation"
|
||||
msgstr "Ist CEF Maßnahme"
|
||||
|
||||
#: compensation/templates/compensation/detail/compensation/view.html:64
|
||||
msgid "Is Coherence keeping compensation"
|
||||
msgstr "Ist Kohärenzsicherungsmaßnahme"
|
||||
|
||||
#: compensation/templates/compensation/detail/compensation/view.html:76
|
||||
#: compensation/templates/compensation/detail/compensation/view.html:86
|
||||
#: intervention/templates/intervention/detail/view.html:80
|
||||
msgid "Checked on "
|
||||
msgstr "Geprüft am "
|
||||
|
||||
#: compensation/templates/compensation/detail/compensation/view.html:76
|
||||
#: compensation/templates/compensation/detail/compensation/view.html:90
|
||||
#: compensation/templates/compensation/detail/compensation/view.html:86
|
||||
#: compensation/templates/compensation/detail/compensation/view.html:100
|
||||
#: compensation/templates/compensation/detail/eco_account/includes/deductions.html:56
|
||||
#: compensation/templates/compensation/detail/eco_account/view.html:52
|
||||
#: ema/templates/ema/detail/view.html:42
|
||||
@ -990,27 +1009,27 @@ msgstr "Geprüft am "
|
||||
msgid "by"
|
||||
msgstr "von"
|
||||
|
||||
#: compensation/templates/compensation/detail/compensation/view.html:90
|
||||
#: compensation/templates/compensation/detail/compensation/view.html:100
|
||||
#: compensation/templates/compensation/detail/eco_account/view.html:52
|
||||
#: ema/templates/ema/detail/view.html:42
|
||||
#: intervention/templates/intervention/detail/view.html:94
|
||||
msgid "Recorded on "
|
||||
msgstr "Verzeichnet am"
|
||||
|
||||
#: compensation/templates/compensation/detail/compensation/view.html:97
|
||||
#: compensation/templates/compensation/detail/eco_account/view.html:75
|
||||
#: compensation/templates/compensation/detail/compensation/view.html:107
|
||||
#: compensation/templates/compensation/detail/eco_account/view.html:85
|
||||
#: compensation/templates/compensation/report/compensation/report.html:24
|
||||
#: compensation/templates/compensation/report/eco_account/report.html:37
|
||||
#: ema/templates/ema/detail/view.html:61
|
||||
#: ema/templates/ema/detail/view.html:71
|
||||
#: ema/templates/ema/report/report.html:24
|
||||
#: intervention/templates/intervention/detail/view.html:113
|
||||
#: intervention/templates/intervention/report/report.html:87
|
||||
msgid "Last modified"
|
||||
msgstr "Zuletzt bearbeitet"
|
||||
|
||||
#: compensation/templates/compensation/detail/compensation/view.html:111
|
||||
#: compensation/templates/compensation/detail/eco_account/view.html:89
|
||||
#: ema/templates/ema/detail/view.html:75
|
||||
#: compensation/templates/compensation/detail/compensation/view.html:121
|
||||
#: compensation/templates/compensation/detail/eco_account/view.html:99
|
||||
#: ema/templates/ema/detail/view.html:85
|
||||
#: intervention/templates/intervention/detail/view.html:127
|
||||
msgid "Shared with"
|
||||
msgstr "Freigegeben für"
|
||||
@ -1202,11 +1221,11 @@ msgstr "Freigabelink ungültig"
|
||||
msgid "Share settings updated"
|
||||
msgstr "Freigabe Einstellungen aktualisiert"
|
||||
|
||||
#: ema/forms.py:41 ema/views.py:98
|
||||
#: ema/forms.py:43 ema/views.py:98
|
||||
msgid "New EMA"
|
||||
msgstr "Neue EMA hinzufügen"
|
||||
|
||||
#: ema/forms.py:102
|
||||
#: ema/forms.py:106
|
||||
msgid "Edit EMA"
|
||||
msgstr "Bearbeite EMA"
|
||||
|
||||
@ -2548,11 +2567,11 @@ msgstr "Neuen Token generieren"
|
||||
msgid "A new token needs to be validated by an administrator!"
|
||||
msgstr "Neue Tokens müssen durch Administratoren freigeschaltet werden!"
|
||||
|
||||
#: user/forms.py:168 user/forms.py:172 user/forms.py:351 user/forms.py:356
|
||||
#: user/forms.py:168 user/forms.py:172 user/forms.py:354 user/forms.py:359
|
||||
msgid "Team name"
|
||||
msgstr "Team Name"
|
||||
|
||||
#: user/forms.py:179 user/forms.py:364 user/templates/user/team/index.html:30
|
||||
#: user/forms.py:179 user/forms.py:367 user/templates/user/team/index.html:30
|
||||
msgid "Description"
|
||||
msgstr "Beschreibung"
|
||||
|
||||
@ -2604,7 +2623,7 @@ msgstr "Es muss mindestens einen Administrator für das Team geben."
|
||||
msgid "Edit team"
|
||||
msgstr "Team bearbeiten"
|
||||
|
||||
#: user/forms.py:336
|
||||
#: user/forms.py:335
|
||||
msgid ""
|
||||
"ATTENTION!\n"
|
||||
"\n"
|
||||
@ -2613,16 +2632,18 @@ msgid ""
|
||||
"\n"
|
||||
"Are you sure to remove this team?"
|
||||
msgstr ""
|
||||
"ACHTUNG!\n\n"
|
||||
"Wenn dieses Team gelöscht wird, verlieren alle Teammitglieder den Zugriff auf die Daten, die nur über dieses Team freigegeben sind!\n"
|
||||
"ACHTUNG!\n"
|
||||
"\n"
|
||||
"Wenn dieses Team gelöscht wird, verlieren alle Teammitglieder den Zugriff "
|
||||
"auf die Daten, die nur über dieses Team freigegeben sind!\n"
|
||||
"\n"
|
||||
"Sind Sie sicher, dass Sie dieses Team löschen möchten?"
|
||||
|
||||
#: user/forms.py:342 user/templates/user/team/index.html:56
|
||||
#: user/forms.py:345 user/templates/user/team/index.html:56
|
||||
msgid "Leave team"
|
||||
msgstr "Team verlassen"
|
||||
|
||||
#: user/forms.py:375
|
||||
#: user/forms.py:378
|
||||
msgid "Team"
|
||||
msgstr "Team"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user