[Zope-CMF] Workflow transitions automatic state changing

Wichert Akkerman wichert at wiggy.net
Wed May 20 04:59:56 EDT 2009


Previously Thomas Dingeldey wrote:
> Hi,
> 
> I have a question about the transitions of a workflow.
> In ZMI you could choose the option automatic in a transition. Does the option 
> only remove the action if you call "atool.listFilteredActionsFor(item)" or is 
> it intended to do some more?
> 
> We start a process with a workflow which runs a long time, if the process 
> starts, we move the object into another state with a transition:
> 
> wf = getToolByName(self.context, 'portal_workflow')
> wf.doActionFor(self.context, 'send', comment='send')
> 
> If the process is finished we like to move the object automatically into 
> another state. Provides the workflow functions which assists this?

from plone.app.workflow:

   # Trigger any automatic transitions, or else just make sure the role mappings are right
   auto_transition = new_wf._findAutomaticTransition(obj, new_wf._getWorkflowStateOf(obj))
   if auto_transition is not None:
       new_wf._changeStateOf(obj, auto_transition)

new_wf is the workflow used for this object. You can grab that from the workflow
chain configured for the object. You should probably make sure to do this for
every workflow in the chain to make support you handle objects with multiple
workflows correctly.


Wichert.

-- 
Wichert Akkerman <wichert at wiggy.net>    It is simple to make things.
http://www.wiggy.net/                   It is hard to make things simple.


More information about the Zope-CMF mailing list