Reset publication info on cancelled or refused publication request
authorThierry Florac <thierry.florac@onf.fr>
Tue, 16 Jan 2018 15:24:29 +0100
changeset 327 f31d61be8b65
parent 326 00d381f985c8
child 328 3ae323f42a24
Reset publication info on cancelled or refused publication request
src/pyams_content/workflow/__init__.py
--- a/src/pyams_content/workflow/__init__.py	Tue Jan 16 14:24:44 2018 +0100
+++ b/src/pyams_content/workflow/__init__.py	Tue Jan 16 15:24:29 2018 +0100
@@ -230,6 +230,11 @@
 # Workflow actions
 #
 
+def reset_publication_action(wf, context):
+    """Refuse version publication"""
+    IWorkflowPublicationInfo(context).reset(complete=True)
+
+
 def publish_action(wf, context):
     """Publish version"""
     request = check_request()
@@ -312,6 +317,7 @@
                                   destination=CANCELED,
                                   permission=MANAGE_CONTENT_PERMISSION,
                                   condition=can_cancel_operation,
+                                  action=reset_publication_action,
                                   menu_css_class='fa fa-fw fa-mail-reply',
                                   view_name='wf-cancel-propose.html',
                                   history_label=_("Publication request canceled"),
@@ -341,6 +347,7 @@
                                  destination=REFUSED,
                                  permission=PUBLISH_CONTENT_PERMISSION,
                                  condition=can_manage_content,
+                                 action=reset_publication_action,
                                  menu_css_class='fa fa-fw fa-thumbs-o-down',
                                  view_name='wf-refuse.html',
                                  history_label=_("Publication refused"),