# 86 Proper log detail

* adds support for payment adding/deleting to intervention log
* adds support for deduction adding/deleting to intervention/ecoaccount log
* improves code snippets
* drops add_deduction() methods for ecoaccount and intervention in favor of simpler creation in NewDeductionModalForm
* adds messages
* adds/updates translations
This commit is contained in:
2022-02-02 15:16:25 +01:00
parent f224bbb5bd
commit a9215511ac
17 changed files with 289 additions and 266 deletions

View File

@@ -26,7 +26,7 @@ from konova.models import generate_document_file_upload_path, AbstractDocument,
ShareableObjectMixin, \
RecordableObjectMixin, CheckableObjectMixin, GeoReferencedMixin
from konova.settings import LANIS_LINK_TEMPLATE, LANIS_ZOOM_LUT, DEFAULT_SRID_RLP
from konova.utils.message_templates import DATA_UNSHARED_EXPLANATION
from konova.utils.message_templates import DATA_UNSHARED_EXPLANATION, DEDUCTION_ADDED
from user.models import UserActionLogEntry
@@ -229,28 +229,6 @@ class Intervention(BaseObject, ShareableObjectMixin, RecordableObjectMixin, Chec
)
return revocation
def add_deduction(self, form):
""" Adds a new deduction to the intervention
Args:
form (NewDeductionModalForm): The form holding the data
Returns:
"""
form_data = form.cleaned_data
user = form.user
with transaction.atomic():
user_action_create = UserActionLogEntry.get_created_action(user)
deduction = EcoAccountDeduction.objects.create(
intervention=self,
account=form_data["account"],
surface=form_data["surface"],
created=user_action_create,
)
return deduction
def mark_as_edited(self, performing_user: User, request: HttpRequest = None, edit_comment: str = None, reset_recorded: bool = True):
""" In case the object or a related object changed, internal processes need to be started, such as
unrecord and uncheck
@@ -264,9 +242,10 @@ class Intervention(BaseObject, ShareableObjectMixin, RecordableObjectMixin, Chec
Returns:
"""
super().mark_as_edited(performing_user, request, edit_comment, reset_recorded)
action = super().mark_as_edited(performing_user, request, edit_comment, reset_recorded)
if self.checked:
self.set_unchecked()
return action
def set_status_messages(self, request: HttpRequest):
""" Setter for different information that need to be rendered