diff --git a/src/pfwbged/policy/menu.py b/src/pfwbged/policy/menu.py
index 419afbd..41255ca 100644
--- a/src/pfwbged/policy/menu.py
+++ b/src/pfwbged/policy/menu.py
@@ -167,6 +167,10 @@ class CustomMenu(menu.WorkflowMenu):
if action['category'] != 'workflow':
continue
+ # that action is already triggered when returning responsibility on a task
+ if action['id'] == 'back_to_assigning' and IDmsDocument.providedBy(context) and api.content.get_state(context) == 'processing':
+ continue
+
cssClass = 'kssIgnore'
actionUrl = action['url']
if actionUrl == "":
diff --git a/src/pfwbged/policy/profiles/default/workflows/pfwbgeddocument_workflow/definition.xml b/src/pfwbged/policy/profiles/default/workflows/pfwbgeddocument_workflow/definition.xml
index e9d3313..4fb7e31 100644
--- a/src/pfwbged/policy/profiles/default/workflows/pfwbgeddocument_workflow/definition.xml
+++ b/src/pfwbged/policy/profiles/default/workflows/pfwbgeddocument_workflow/definition.xml
@@ -149,6 +149,7 @@
+
Editor
Manager
diff --git a/src/pfwbged/policy/subscribers/document.py b/src/pfwbged/policy/subscribers/document.py
index 91b0ed4..3361ae4 100644
--- a/src/pfwbged/policy/subscribers/document.py
+++ b/src/pfwbged/policy/subscribers/document.py
@@ -179,6 +179,16 @@ def task_in_progress(context, event):
document = obj
api.content.transition(obj=document, transition='directly_noaction')
document.reindexObject(idxs=['review_state'])
+ elif event.transition and event.transition.id == 'return-responsibility':
+ obj = aq_parent(context)
+ if not IPfwbDocument.providedBy(obj):
+ return
+ # only applies to "other documents"
+ if not has_pfwbgeddocument_workflow(obj):
+ return
+ document = obj
+ api.content.transition(obj=document, transition='back_to_assigning')
+ document.reindexObject(idxs=['review_state'])
def transition_tasks(obj, types, status, transition):
@@ -271,6 +281,11 @@ def document_is_finished(context, event):
def document_is_reopened(context, event):
"""When a document is reoponed, create a new task"""
if has_pfwbgeddocument_workflow(context) and event.transition is not None and event.new_state.id == 'assigning':
+
+ # Task responsibility has just been returned
+ if event.old_state.id == 'processing':
+ return
+
creator = api.user.get_current().getId()
params = {'responsible': [],
'title': translate(_(u'Process document'),