* refactors CheckableMixin and RecordableMixin into CheckableObject and RecordableObject
* adds ShareableObject for wrapping share related fields and functionality
* adds share functionality to EcoAccount and EMA, just like Intervention
This commit is contained in:
2021-10-26 15:09:30 +02:00
parent 7c7a21052a
commit c4af63cea2
11 changed files with 220 additions and 117 deletions
+2 -19
View File
@@ -22,7 +22,7 @@ from compensation.managers import CompensationStateManager, EcoAccountDeductionM
from compensation.utils.quality import CompensationQualityChecker, EcoAccountQualityChecker
from intervention.models import Intervention, ResponsibilityData, LegalData
from konova.models import BaseObject, BaseResource, Geometry, UuidModel, AbstractDocument, \
generate_document_file_upload_path, RecordableMixin
generate_document_file_upload_path, RecordableObject, ShareableObject
from konova.settings import DEFAULT_SRID_RLP, LANIS_LINK_TEMPLATE
from user.models import UserActionLogEntry
@@ -311,28 +311,11 @@ class CompensationDocument(AbstractDocument):
pass
class EcoAccount(AbstractCompensation, RecordableMixin):
class EcoAccount(AbstractCompensation, ShareableObject, RecordableObject):
"""
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.
"""
# Users having access on this object
# Not needed in regular Compensation since their access is defined by the linked intervention's access
users = models.ManyToManyField(
User,
help_text="Users having access (shared with)"
)
# Refers to "verzeichnen"
recorded = models.OneToOneField(
UserActionLogEntry,
on_delete=models.SET_NULL,
null=True,
blank=True,
help_text="Holds data on user and timestamp of this action",
related_name="+"
)
deductable_surface = models.FloatField(
blank=True,
null=True,