[DOC] workflows: improved Triggers section.
bzr revid: vmt@openerp.com-20130723151249-oa18owwzg82ea79t
This commit is contained in:
parent
3f9fb6eacc
commit
8501e89735
|
@ -74,7 +74,9 @@ been processed), and thus also process the "b" activity.
|
||||||
Transitions
|
Transitions
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
Transitions provide the control structures to orchestrate a workflow. In their
|
Transitions provide the control structures to orchestrate a workflow. When an
|
||||||
|
activity is completed, the workflow engine will try to get across transitions
|
||||||
|
departing from the completed activity, towards the next activities. In their
|
||||||
simplest form they just link activities from one to the others (as in the
|
simplest form they just link activities from one to the others (as in the
|
||||||
example above), and activities are processed as soon as the activities
|
example above), and activities are processed as soon as the activities
|
||||||
preceding them are completed.
|
preceding them are completed.
|
||||||
|
@ -129,28 +131,23 @@ attribute of the button.
|
||||||
Triggers
|
Triggers
|
||||||
''''''''
|
''''''''
|
||||||
|
|
||||||
When an activity is completed, the workflow engine will try to get across
|
With conditions that evaluate to false, transitions are not taken (and thus the
|
||||||
transitions departing from the completed activity, towards the next activities.
|
|
||||||
To get across a transition, its associated condition should evaluate to True.
|
|
||||||
If the condition evaluates to False, the transition is not taken (and thus the
|
|
||||||
activity it leads to will not be processed). Still, the workflow instance can
|
activity it leads to will not be processed). Still, the workflow instance can
|
||||||
get new chances to progress across that transition by providing so-called
|
get new chances to progress across that transition by providing so-called
|
||||||
triggers. The idea is that when the condition fails, triggers (actually just
|
triggers. The idea is that when the condition fails, triggers are recorded in
|
||||||
model name/record IDs pairs) are recorded in database. Later, it is possible to
|
database. Later, it is possible to wake-up specifically the workflow instances
|
||||||
wake-up specifically the workflow instances that installed those triggers,
|
that installed those triggers, offering them a new chance to evaluation their
|
||||||
offering them a new chance to evaluation their transition conditions. This
|
transition conditions. This mechnism makes it cheaper to wake-up workflow
|
||||||
mechnism makes it cheaper to wake-up workflow instances by targetting just a
|
instances by targetting just a few of them (those that have installed the
|
||||||
few of them (those that have installed the triggers) instead of all of them.
|
triggers) instead of all of them.
|
||||||
|
|
||||||
On each transition, in addition to a condition, records can be defined as a
|
Triggers are recorded in database as record IDs (together with the model name)
|
||||||
trigger. The records will be defined as triggers as the transition is tried
|
and refer to the workflow instance waiting for them. The transition definition
|
||||||
withing a workflow, after the condition has failed. The actual records are
|
can thus provide a Python expression (using the ``trigger_model`` attribute)
|
||||||
stored as model name and record ids. The model name is defined by the
|
that when evaluated will return the record IDs. Unlike the other expressions
|
||||||
trigger_model attribute of the transition while the record IDs are retrived by
|
defined on the workflow, this one is evaluated with respect to a model that can
|
||||||
evaluating the trigger_expression (also defined on the transition).
|
be chosen on a per-transition basis with the ``trigger_expression`` attribute.
|
||||||
|
|
||||||
- I think the triggers are never deleted from the database. They are: they are
|
.. note:: Note that triggers are not re-installed whenever the transition is
|
||||||
'on delete cascade' on both the workflow instance and the workitem.
|
re-tried.
|
||||||
|
|
||||||
- Are those triggers re-installed whenever the transition is tried ? Nope.
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue