diff --git a/backoffice/backoffice/workflows/admin.py b/backoffice/backoffice/workflows/admin.py index 3aa26827..bc5c3d64 100644 --- a/backoffice/backoffice/workflows/admin.py +++ b/backoffice/backoffice/workflows/admin.py @@ -63,6 +63,21 @@ def has_delete_permission(self, request, obj=None): } +class WorkflowsDecisionsInline(admin.StackedInline): + model = Decision + extra = 0 + can_delete = False + show_change_link = True + readonly_fields = ["action_value", "_updated_at", "user"] + + def has_change_permission(self, request, obj=None): + return False + + @admin.display(description="action") + def action_value(self, obj): + return obj.action + + @admin.register(Workflow) class WorkflowAdmin(BaseModelAdmin): """ @@ -89,6 +104,8 @@ class WorkflowAdmin(BaseModelAdmin): "_updated_at", ] + inlines = [WorkflowsDecisionsInline] + @admin.register(Decision) class DecisionAdmin(BaseModelAdmin): diff --git a/backoffice/backoffice/workflows/documents.py b/backoffice/backoffice/workflows/documents.py index 862b6e3a..e2240d15 100644 --- a/backoffice/backoffice/workflows/documents.py +++ b/backoffice/backoffice/workflows/documents.py @@ -9,28 +9,7 @@ class WorkflowDocument(Document): id = fields.TextField() workflow_type = fields.KeywordField() - data = fields.ObjectField( - properties={ - "ids": fields.ObjectField( - properties={ - "value": fields.KeywordField(), - "schema": fields.KeywordField(), - } - ), - "name": fields.ObjectField( - properties={ - "value": fields.TextField(), - "preferred_name": fields.TextField(), - } - ), - "email_address": fields.ObjectField( - properties={ - "value": fields.KeywordField(), - "current": fields.BooleanField(), - } - ), - } - ) + data = fields.ObjectField(dynamic=True) decisions = fields.NestedField( properties={