# 86 More log details Documents

* adds more log details on adding/removing documents
* fixes bug in admin backend where restoring of non-compensation entries led to an error
* fixes bug where deleting of revocation without an attached file would lead to an error
This commit is contained in:
2022-02-04 09:18:46 +01:00
parent 0a6d5cf19b
commit 298a632cac
13 changed files with 56 additions and 26 deletions

View File

@@ -3,6 +3,8 @@ from django.contrib import admin
from compensation.models import Compensation, CompensationAction, CompensationState, Payment, \
EcoAccountDeduction, EcoAccount
from konova.admin import BaseObjectAdmin, BaseResourceAdmin
from konova.utils.message_templates import COMPENSATION_REMOVED_TEMPLATE
from user.models import UserAction
class AbstractCompensationAdmin(BaseObjectAdmin):
@@ -42,6 +44,17 @@ class CompensationAdmin(AbstractCompensationAdmin):
"intervention",
]
def restore_deleted_data(self, request, queryset):
super().restore_deleted_data(request, queryset)
for entry in queryset:
# Remove delete log entry from related intervention log history
logs = entry.intervention.log.filter(
action=UserAction.EDITED,
comment=COMPENSATION_REMOVED_TEMPLATE.format(entry.identifier)
)
logs.delete()
class EcoAccountAdmin(AbstractCompensationAdmin):
list_display = [