Commit 1a9c7015 authored by Gabriel Monnerat's avatar Gabriel Monnerat

check first if the transition is possible

parent ea76b7a1
......@@ -50,9 +50,11 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>packing_list_line = context.SlaveInstance_getInstanceHostingPackingListLine(state_change)\n
<value> <string>isTransitionPossible = context.portal_workflow.isTransitionPossible\n
packing_list_line = context.SlaveInstance_getInstanceHostingPackingListLine(state_change)\n
packing_list = packing_list_line.getParentValue()\n
packing_list.start()\n
if isTransitionPossible(packing_list, "start"):\n
packing_list.start()\n
</string> </value>
</item>
<item>
......
......@@ -54,8 +54,10 @@
packing_list_line = context.SlaveInstance_getInstanceHostingPackingListLine(state_change)\n
except ValueError:\n
return\n
isTransitionPossible = context.portal_workflow.isTransitionPossible\n
packing_list = packing_list_line.getParentValue()\n
packing_list.deliver()\n
if isTransitionPossible(packing_list, "deliver"):\n
packing_list.deliver()\n
</string> </value>
</item>
<item>
......
......@@ -52,7 +52,8 @@
<key> <string>_body</string> </key>
<value> <string>packing_list_line = context.SlaveInstance_getInstanceSetupPackingListLine(state_change)\n
packing_list = packing_list_line.getParentValue()\n
if packing_list.getPortalObject().portal_workflow.isTransitionPossible(packing_list, \'stop\'):\n
isTransitionPossible = context.portal_workflow.isTransitionPossible\n
if isTransitionPossible(packing_list, \'stop\'):\n
packing_list.stop()\n
</string> </value>
</item>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment