# 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 4563c222e9
commit b17b0b5144
17 changed files with 289 additions and 266 deletions

View File

@@ -327,7 +327,7 @@ class RemoveModalForm(BaseModalForm):
self.instance.mark_as_deleted(self.user)
else:
# If the class does not provide restorable delete functionality, we must delete the entry finally
self.instance.delete()
self.instance.delete(self.user)
class NewDocumentForm(BaseModalForm):

View File

@@ -275,9 +275,9 @@ class RecordableObjectMixin(models.Model):
Returns:
"""
action = UserActionLogEntry.get_edited_action(performing_user, edit_comment)
self.modified = action
self.log.add(action)
edit_action = UserActionLogEntry.get_edited_action(performing_user, edit_comment)
self.modified = edit_action
self.log.add(edit_action)
self.save()
if self.recorded and reset_recorded:
@@ -288,6 +288,7 @@ class RecordableObjectMixin(models.Model):
request,
CHECKED_RECORDED_RESET
)
return edit_action
@abstractmethod
def is_ready_for_publish(self) -> bool:

View File

@@ -21,6 +21,14 @@ CHECKED_RECORDED_RESET = _("Status of Checked and Recorded reseted")
# ECO ACCOUNT
CANCEL_ACC_RECORDED_OR_DEDUCTED = _("Action canceled. Eco account is recorded or deductions exist. Only conservation office member can perform this action.")
# DEDUCTIONS
DEDUCTION_ADDED = _("Deduction added")
DEDUCTION_REMOVED = _("Deduction removed")
# PAYMENTS
PAYMENT_ADDED = _("Payment added")
PAYMENT_REMOVED = _("Payment removed")
# Edited
EDITED_GENERAL_DATA = _("Edited general data")
ADDED_COMPENSATION_STATE = _("Added compensation state")