From 907d360c36aaa52b86c53d0ce387d10ae10cc6ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Mon, 30 Jun 2014 15:03:42 +0200 Subject: [PATCH] add abandoned status to basic task and validation workflows (#4938) --- .../basic_task_workflow/definition.xml | 19 +++++++++++++++++ .../validation_workflow/definition.xml | 21 +++++++++++++++++++ src/collective/task/subscribers.py | 10 +++++++-- 3 files changed, 48 insertions(+), 2 deletions(-) diff --git a/src/collective/task/profiles/default/workflows/basic_task_workflow/definition.xml b/src/collective/task/profiles/default/workflows/basic_task_workflow/definition.xml index 7e80daf..6698af7 100644 --- a/src/collective/task/profiles/default/workflows/basic_task_workflow/definition.xml +++ b/src/collective/task/profiles/default/workflows/basic_task_workflow/definition.xml @@ -22,6 +22,7 @@ + Editor Manager @@ -34,10 +35,28 @@ Reviewer + + + Manager + Reviewer + Editor + Reader + + + Manager + + + Mark as done Editor + + Abandon + + Manager + + diff --git a/src/collective/task/profiles/default/workflows/validation_workflow/definition.xml b/src/collective/task/profiles/default/workflows/validation_workflow/definition.xml index 34587eb..8088b8d 100644 --- a/src/collective/task/profiles/default/workflows/validation_workflow/definition.xml +++ b/src/collective/task/profiles/default/workflows/validation_workflow/definition.xml @@ -34,6 +34,7 @@ + Editor Manager @@ -46,6 +47,19 @@ Reviewer + + + Manager + Reviewer + Editor + Reader + + + Manager + + + + Validate @@ -58,4 +72,11 @@ Editor + + Abandon + + Manager + + + diff --git a/src/collective/task/subscribers.py b/src/collective/task/subscribers.py index 230f6f2..6325a46 100644 --- a/src/collective/task/subscribers.py +++ b/src/collective/task/subscribers.py @@ -41,11 +41,17 @@ def task_changed_state(context, event): with api.env.adopt_roles(['Reviewer']): if event.new_state.id == 'done': with api.env.adopt_user('admin'): - api.content.transition(obj=parent, transition='subtask-done') + try: + api.content.transition(obj=parent, transition='subtask-done') + except api.exc.InvalidParameterError: + pass parent.reindexObject(idxs=['review_state']) elif event.new_state.id == 'abandoned': with api.env.adopt_user('admin'): - api.content.transition(obj=parent, transition='subtask-abandoned') + try: + api.content.transition(obj=parent, transition='subtask-abandoned') + except api.exc.InvalidParameterError: + pass parent.reindexObject(idxs=['review_state'])