~openerp-community/openobject-doc/ksa-openobject-doc-6.0

« back to all changes in this revision

Viewing changes to i18n/ru/source/developer/3_9_Workflow_Business_Process/index.rst

  • Committer: Don Kirkby
  • Date: 2011-02-21 20:46:11 UTC
  • mfrom: (433.1.53 openobject-doc)
  • Revision ID: donkirkby+launpd@gmail.com-20110221204611-1ykt6dmg4k3gh5dh
[MERGE] revisions 477 to 486 from the 5.0 branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
.. i18n: =========================
 
3
.. i18n: Workflow-Business Process
 
4
.. i18n: =========================
 
5
..
 
6
 
 
7
=========================
 
8
Workflow-Business Process
 
9
=========================
 
10
 
 
11
.. i18n: Introduction
 
12
.. i18n: ============
 
13
..
 
14
 
 
15
Introduction
 
16
============
 
17
 
 
18
.. i18n: The workflow system in OpenERP is a very powerful mechanism that can describe the evolution of documents (model) in time.
 
19
..
 
20
 
 
21
The workflow system in OpenERP is a very powerful mechanism that can describe the evolution of documents (model) in time.
 
22
 
 
23
.. i18n: Workflows are entirely customizable, they can be adapted to the flows and trade logic of almost any company. The workflow system makes OpenERP very flexible and allows it to easily support changing needs without having to program new functionalities.
 
24
..
 
25
 
 
26
Workflows are entirely customizable, they can be adapted to the flows and trade logic of almost any company. The workflow system makes OpenERP very flexible and allows it to easily support changing needs without having to program new functionalities.
 
27
 
 
28
.. i18n: **Goals**
 
29
..
 
30
 
 
31
**Goals**
 
32
 
 
33
.. i18n:     * description of document evolution in time
 
34
.. i18n:     * automatic trigger of actions if some conditions are met
 
35
.. i18n:     * management of company roles and validation steps
 
36
.. i18n:     * management of interactions between the different objects/modules
 
37
.. i18n:     * graphical tool for visualization of document flows
 
38
..
 
39
 
 
40
    * description of document evolution in time
 
41
    * automatic trigger of actions if some conditions are met
 
42
    * management of company roles and validation steps
 
43
    * management of interactions between the different objects/modules
 
44
    * graphical tool for visualization of document flows
 
45
 
 
46
.. i18n: **To understand its utility, see these three examples:**
 
47
..
 
48
 
 
49
**To understand its utility, see these three examples:**
 
50
 
 
51
.. i18n: WkfExample1: Discount On Orders
 
52
.. i18n: -------------------------------
 
53
..
 
54
 
 
55
WkfExample1: Discount On Orders
 
56
-------------------------------
 
57
 
 
58
.. i18n: The first diagram represent a very basic workflow of an order:
 
59
..
 
60
 
 
61
The first diagram represent a very basic workflow of an order:
 
62
 
 
63
.. i18n: .. image:: images/Workflow_bc1.png
 
64
..
 
65
 
 
66
.. image:: images/Workflow_bc1.png
 
67
 
 
68
.. i18n: The order starts in the 'draft' state, when it is in redaction and not approved. When the user press on the 'Confirm' button, the invoice is created and the order comes into the 'CONFIRMED' state.
 
69
..
 
70
 
 
71
The order starts in the 'draft' state, when it is in redaction and not approved. When the user press on the 'Confirm' button, the invoice is created and the order comes into the 'CONFIRMED' state.
 
72
 
 
73
.. i18n: Then, two operations are possible:
 
74
..
 
75
 
 
76
Then, two operations are possible:
 
77
 
 
78
.. i18n: #. the order is done (shipped)
 
79
.. i18n: 
 
80
.. i18n: #. the order is canceled
 
81
..
 
82
 
 
83
#. the order is done (shipped)
 
84
 
 
85
#. the order is canceled
 
86
 
 
87
.. i18n: Let's suppose a company has a need not implemented in OpenERP. For example, suppose their sales staff can only offer discounts of 15% or less. Every order having a discount above 15% must be approved by the sales manager.
 
88
..
 
89
 
 
90
Let's suppose a company has a need not implemented in OpenERP. For example, suppose their sales staff can only offer discounts of 15% or less. Every order having a discount above 15% must be approved by the sales manager.
 
91
 
 
92
.. i18n: This modification in the sale logic doesn't need any line of python code! A simple modification of the workflow allows us to take this new need into account and add the extra validation step.
 
93
..
 
94
 
 
95
This modification in the sale logic doesn't need any line of python code! A simple modification of the workflow allows us to take this new need into account and add the extra validation step.
 
96
 
 
97
.. i18n: .. image:: images/Workflow_bc2.png
 
98
..
 
99
 
 
100
.. image:: images/Workflow_bc2.png
 
101
 
 
102
.. i18n: The workflow is thus modified as above and the orders will react as we want to. We then only need to modify the order form view and add a validation button at the desired location.
 
103
..
 
104
 
 
105
The workflow is thus modified as above and the orders will react as we want to. We then only need to modify the order form view and add a validation button at the desired location.
 
106
 
 
107
.. i18n: We could then further improve this workflow by sending a request to the sales manager when an order enters the 'Validation' state. Workflow nodes can execute object methods; only two lines of Python are needed to send a request asking the sales manager to validate or not the order.
 
108
..
 
109
 
 
110
We could then further improve this workflow by sending a request to the sales manager when an order enters the 'Validation' state. Workflow nodes can execute object methods; only two lines of Python are needed to send a request asking the sales manager to validate or not the order.
 
111
 
 
112
.. i18n: WkfExample2: A sale order that generates an invoice and a shipping order.
 
113
.. i18n: -------------------------------------------------------------------------
 
114
..
 
115
 
 
116
WkfExample2: A sale order that generates an invoice and a shipping order.
 
117
-------------------------------------------------------------------------
 
118
 
 
119
.. i18n: .. image:: images/Workflow_sale.png
 
120
..
 
121
 
 
122
.. image:: images/Workflow_sale.png
 
123
 
 
124
.. i18n: WkfExample3: Acount invoice basic workflow
 
125
..
 
126
 
 
127
WkfExample3: Acount invoice basic workflow
 
128
 
 
129
.. i18n: .. image:: images/Acount_inv_wkf.jpg
 
130
..
 
131
 
 
132
.. image:: images/Acount_inv_wkf.jpg
 
133
 
 
134
.. i18n: Defining Workflow
 
135
.. i18n: =================
 
136
.. i18n: Workflows are defined in the file server/bin/addons/base/ir/workflow/workflow.py. The first three classes defined in this file are workflow, wkf_activity and wkf_transition. They correspond to the three types of resources that are necessary to describe a workflow :
 
137
..
 
138
 
 
139
Defining Workflow
 
140
=================
 
141
Workflows are defined in the file server/bin/addons/base/ir/workflow/workflow.py. The first three classes defined in this file are workflow, wkf_activity and wkf_transition. They correspond to the three types of resources that are necessary to describe a workflow :
 
142
 
 
143
.. i18n:     * `workflow <http://openobject.com/wiki/index.php/WkfDefXML>`_ : the workflow,
 
144
.. i18n:     * `wkf_activity <http://openobject.com/wiki/index.php/WorkflowActivity>`_ : the activities (nodes),
 
145
.. i18n:     * `wkf_transition <http://openobject.com/wiki/index.php/WorkflowTransition>`_ : the transitions between the activities.
 
146
..
 
147
 
 
148
    * `workflow <http://openobject.com/wiki/index.php/WkfDefXML>`_ : the workflow,
 
149
    * `wkf_activity <http://openobject.com/wiki/index.php/WorkflowActivity>`_ : the activities (nodes),
 
150
    * `wkf_transition <http://openobject.com/wiki/index.php/WorkflowTransition>`_ : the transitions between the activities.
 
151
 
 
152
.. i18n: General structure of a workflow XML file
 
153
.. i18n: ========================================
 
154
..
 
155
 
 
156
General structure of a workflow XML file
 
157
========================================
 
158
 
 
159
.. i18n: The general structure of a workflow XML file is as follows :
 
160
..
 
161
 
 
162
The general structure of a workflow XML file is as follows :
 
163
 
 
164
.. i18n: .. code-block:: xml
 
165
.. i18n: 
 
166
.. i18n:     <?xml version="1.0"?>
 
167
.. i18n:     <openerp>
 
168
.. i18n:     <data>
 
169
.. i18n:     <record model="workflow" id=workflow_id>
 
170
.. i18n: 
 
171
.. i18n:         <field name="name">workflow.name</field>
 
172
.. i18n:         <field name="osv">resource.model</field>
 
173
.. i18n:         <field name="on_create">True | False</field>
 
174
.. i18n: 
 
175
.. i18n:     </record>
 
176
.. i18n: 
 
177
.. i18n:     </data>
 
178
.. i18n:     </openerp>
 
179
..
 
180
 
 
181
.. code-block:: xml
 
182
 
 
183
    <?xml version="1.0"?>
 
184
    <openerp>
 
185
    <data>
 
186
    <record model="workflow" id=workflow_id>
 
187
 
 
188
        <field name="name">workflow.name</field>
 
189
        <field name="osv">resource.model</field>
 
190
        <field name="on_create">True | False</field>
 
191
 
 
192
    </record>
 
193
 
 
194
    </data>
 
195
    </openerp>
 
196
 
 
197
.. i18n: **Where**
 
198
..
 
199
 
 
200
**Where**
 
201
 
 
202
.. i18n:     * **id** (here "workflow_id") is a workflow identifier. Each workflow must have an unique identifier.
 
203
.. i18n:     * **name** (here "workflow.name") is the name of the workflow. The name of the workflow must respect the OpenERP syntax of "dotted names".
 
204
.. i18n:     * **osv** (here "resource.model") is the name of the object we use as a model [-(Remember an OpenERP object inherits from osv.osv, hence the '<field name="osv">')-].
 
205
.. i18n:     * **on_create** is True if workflow.name must be instantiated automatically when resource.model is created, and False otherwise.
 
206
..
 
207
 
 
208
    * **id** (here "workflow_id") is a workflow identifier. Each workflow must have an unique identifier.
 
209
    * **name** (here "workflow.name") is the name of the workflow. The name of the workflow must respect the OpenERP syntax of "dotted names".
 
210
    * **osv** (here "resource.model") is the name of the object we use as a model [-(Remember an OpenERP object inherits from osv.osv, hence the '<field name="osv">')-].
 
211
    * **on_create** is True if workflow.name must be instantiated automatically when resource.model is created, and False otherwise.
 
212
 
 
213
.. i18n: **Example**
 
214
..
 
215
 
 
216
**Example**
 
217
 
 
218
.. i18n: The workflow **"sale.order.basic"** defined in addons/sale/sale_workflow.xml follows exactly this model, the code of its workflow tag is :
 
219
..
 
220
 
 
221
The workflow **"sale.order.basic"** defined in addons/sale/sale_workflow.xml follows exactly this model, the code of its workflow tag is :
 
222
 
 
223
.. i18n: .. code-block:: xml
 
224
.. i18n: 
 
225
.. i18n:     <record model="workflow" id="wkf_sale">
 
226
.. i18n: 
 
227
.. i18n:         <field name="name">sale.order.basic</field>
 
228
.. i18n:         <field name="osv">sale.order</field>
 
229
.. i18n:         <field name="on_create">True</field>
 
230
.. i18n: 
 
231
.. i18n:     </record>
 
232
..
 
233
 
 
234
.. code-block:: xml
 
235
 
 
236
    <record model="workflow" id="wkf_sale">
 
237
 
 
238
        <field name="name">sale.order.basic</field>
 
239
        <field name="osv">sale.order</field>
 
240
        <field name="on_create">True</field>
 
241
 
 
242
    </record>
 
243
 
 
244
.. i18n: Activity
 
245
.. i18n: ==========
 
246
..
 
247
 
 
248
Activity
 
249
==========
 
250
 
 
251
.. i18n: Introduction
 
252
.. i18n: ------------
 
253
..
 
254
 
 
255
Introduction
 
256
------------
 
257
 
 
258
.. i18n: The wkf_activity class represents the nodes of workflows. These nodes are the actions to be executed.
 
259
..
 
260
 
 
261
The wkf_activity class represents the nodes of workflows. These nodes are the actions to be executed.
 
262
 
 
263
.. i18n: The fields
 
264
.. i18n: ----------
 
265
..
 
266
 
 
267
The fields
 
268
----------
 
269
 
 
270
.. i18n: split_mode
 
271
.. i18n: ----------
 
272
..
 
273
 
 
274
split_mode
 
275
----------
 
276
 
 
277
.. i18n: .. image::  images/Wkf_split.png
 
278
..
 
279
 
 
280
.. image::  images/Wkf_split.png
 
281
 
 
282
.. i18n: * XOR: One necessary transition, takes the first one found (default).
 
283
.. i18n: * OR : Take only valid transitions (0 or more) in sequential order.
 
284
.. i18n: * AND: All valid transitions are launched at the same time (fork).
 
285
..
 
286
 
 
287
* XOR: One necessary transition, takes the first one found (default).
 
288
* OR : Take only valid transitions (0 or more) in sequential order.
 
289
* AND: All valid transitions are launched at the same time (fork).
 
290
 
 
291
.. i18n: In the OR and AND separation mode, certain workitems can be generated.
 
292
..
 
293
 
 
294
In the OR and AND separation mode, certain workitems can be generated.
 
295
 
 
296
.. i18n: In the AND mode, the activity waits for all transitions to be valid, even if some of them are already valid. They are all triggered at the same time.
 
297
..
 
298
 
 
299
In the AND mode, the activity waits for all transitions to be valid, even if some of them are already valid. They are all triggered at the same time.
 
300
 
 
301
.. i18n: join_mode
 
302
.. i18n: ---------
 
303
..
 
304
 
 
305
join_mode
 
306
---------
 
307
 
 
308
.. i18n: .. image:: images/Wkf_join.png
 
309
..
 
310
 
 
311
.. image:: images/Wkf_join.png
 
312
 
 
313
.. i18n: * **XOR**: One transition necessary to continue to the destination activity (default).
 
314
.. i18n: * **AND**: Waits for all transition conditions to be valid to execute the destination activity.
 
315
..
 
316
 
 
317
* **XOR**: One transition necessary to continue to the destination activity (default).
 
318
* **AND**: Waits for all transition conditions to be valid to execute the destination activity.
 
319
 
 
320
.. i18n: kind:
 
321
.. i18n: -----
 
322
..
 
323
 
 
324
kind:
 
325
-----
 
326
 
 
327
.. i18n: :The type of the activity can take several values:
 
328
..
 
329
 
 
330
:The type of the activity can take several values:
 
331
 
 
332
.. i18n:     * **DUMMY**: Do nothing (default).
 
333
.. i18n:     * **FUNCTION**: Execute the function selected by an action.
 
334
.. i18n:     * **SUBFLOW**: Execute a sub-workflow SUBFLOW_ID. The action method must return the ID of the concerned resource by the subflow ! If the action returns False, the workitem disappears !
 
335
.. i18n:     * **STOPALL**:
 
336
..
 
337
 
 
338
    * **DUMMY**: Do nothing (default).
 
339
    * **FUNCTION**: Execute the function selected by an action.
 
340
    * **SUBFLOW**: Execute a sub-workflow SUBFLOW_ID. The action method must return the ID of the concerned resource by the subflow ! If the action returns False, the workitem disappears !
 
341
    * **STOPALL**:
 
342
 
 
343
.. i18n: A sub-workflow is executed when an activity is of the type SUBFLOW. This activity ends when the sub-workflow has finished. While the sub-workflow is active, the workitem of this activity is frozen.
 
344
..
 
345
 
 
346
A sub-workflow is executed when an activity is of the type SUBFLOW. This activity ends when the sub-workflow has finished. While the sub-workflow is active, the workitem of this activity is frozen.
 
347
 
 
348
.. i18n: action:
 
349
.. i18n: -------
 
350
..
 
351
 
 
352
action:
 
353
-------
 
354
 
 
355
.. i18n: The action indicates the method to execute when a workitem comes into this activity. The method must be defined in an object which belongs to this workflow and have the following signature:
 
356
..
 
357
 
 
358
The action indicates the method to execute when a workitem comes into this activity. The method must be defined in an object which belongs to this workflow and have the following signature:
 
359
 
 
360
.. i18n:     def object_method(self, cr, uid, ids):
 
361
..
 
362
 
 
363
    def object_method(self, cr, uid, ids):
 
364
 
 
365
.. i18n: In the action though, they will be called by a statement like:
 
366
..
 
367
 
 
368
In the action though, they will be called by a statement like:
 
369
 
 
370
.. i18n:     object_method()
 
371
..
 
372
 
 
373
    object_method()
 
374
 
 
375
.. i18n: signal_send
 
376
.. i18n: -----------
 
377
..
 
378
 
 
379
signal_send
 
380
-----------
 
381
 
 
382
.. i18n: flow_start
 
383
.. i18n: ----------
 
384
..
 
385
 
 
386
flow_start
 
387
----------
 
388
 
 
389
.. i18n: Indicates if the node is a start node. When a new instance of a workflow is created, a workitem is activated for each activity marked as a flow_start.
 
390
..
 
391
 
 
392
Indicates if the node is a start node. When a new instance of a workflow is created, a workitem is activated for each activity marked as a flow_start.
 
393
 
 
394
.. i18n: .. warning::
 
395
.. i18n: 
 
396
.. i18n:     Be warned to not use this flag unless your activity really is a "flow
 
397
.. i18n:     start". There are tiny versions that do not care about the tags contents
 
398
.. i18n:     like "true" or "false". Using such tag and tiny version, you will always
 
399
.. i18n:     end up with an activity which is tagged as "flow start = true", leaving u
 
400
.. i18n:     with a nasty hunt to find out where your workflow design could be wrong.
 
401
.. i18n: 
 
402
.. i18n:     This is because tags content are always evaluated as string. Read the
 
403
.. i18n:     section about the :ref:`eval attribute <eval-attribute-link>` for an
 
404
.. i18n:     explanation.
 
405
..
 
406
 
 
407
.. warning::
 
408
 
 
409
    Be warned to not use this flag unless your activity really is a "flow
 
410
    start". There are tiny versions that do not care about the tags contents
 
411
    like "true" or "false". Using such tag and tiny version, you will always
 
412
    end up with an activity which is tagged as "flow start = true", leaving u
 
413
    with a nasty hunt to find out where your workflow design could be wrong.
 
414
 
 
415
    This is because tags content are always evaluated as string. Read the
 
416
    section about the :ref:`eval attribute <eval-attribute-link>` for an
 
417
    explanation.
 
418
 
 
419
.. i18n: flow_stop
 
420
.. i18n: ---------
 
421
..
 
422
 
 
423
flow_stop
 
424
---------
 
425
 
 
426
.. i18n: Indicates if the node is an ending node. When all the active workitems for a given instance come in the node marked by flow_stop, the workflow is finished.
 
427
..
 
428
 
 
429
Indicates if the node is an ending node. When all the active workitems for a given instance come in the node marked by flow_stop, the workflow is finished.
 
430
 
 
431
.. i18n: .. warning::
 
432
.. i18n: 
 
433
.. i18n:     Be warned to not use this flag unless your activity really is a "flow
 
434
.. i18n:     stop". There are tiny versions that do not care about the tags contents
 
435
.. i18n:     like "true" or "false". Using such tag and tiny version, you will always
 
436
.. i18n:     end up with an activity which is tagged as "flow stop = true", leaving u
 
437
.. i18n:     with a nasty hunt to find out where your workflow design could be wrong.
 
438
.. i18n: 
 
439
.. i18n:     This is because tags content are always evaluated as string. Read the
 
440
.. i18n:     section about the :ref:`eval attribute <eval-attribute-link>` for an
 
441
.. i18n:     explanation.
 
442
..
 
443
 
 
444
.. warning::
 
445
 
 
446
    Be warned to not use this flag unless your activity really is a "flow
 
447
    stop". There are tiny versions that do not care about the tags contents
 
448
    like "true" or "false". Using such tag and tiny version, you will always
 
449
    end up with an activity which is tagged as "flow stop = true", leaving u
 
450
    with a nasty hunt to find out where your workflow design could be wrong.
 
451
 
 
452
    This is because tags content are always evaluated as string. Read the
 
453
    section about the :ref:`eval attribute <eval-attribute-link>` for an
 
454
    explanation.
 
455
 
 
456
.. i18n: wkf_id
 
457
.. i18n: ------
 
458
..
 
459
 
 
460
wkf_id
 
461
------
 
462
 
 
463
.. i18n: The workflow which this activity belongs to.
 
464
..
 
465
 
 
466
The workflow which this activity belongs to.
 
467
 
 
468
.. i18n: Defining activities using XML files
 
469
.. i18n: -----------------------------------
 
470
..
 
471
 
 
472
Defining activities using XML files
 
473
-----------------------------------
 
474
 
 
475
.. i18n: The general structure of an activity record is as follows
 
476
..
 
477
 
 
478
The general structure of an activity record is as follows
 
479
 
 
480
.. i18n: .. code-block:: xml
 
481
.. i18n: 
 
482
.. i18n:     <record model="workflow.activity" id="''activity_id''">
 
483
.. i18n:           <field name="wkf_id" ref="''workflow_id''"/>
 
484
.. i18n:           <field name="name">''activity.name''</field>::
 
485
.. i18n: 
 
486
.. i18n:           <field name="split_mode">XOR | OR | AND</field>
 
487
.. i18n:           <field name="join_mode">XOR | AND</field>
 
488
.. i18n:           <field name="kind">dummy | function | subflow | stopall</field>
 
489
.. i18n: 
 
490
.. i18n:           <field name="action">''(...)''</field>
 
491
.. i18n:           <field name="signal_send">''(...)''</field>
 
492
.. i18n:           <field name="flow_start">True | False</field>
 
493
.. i18n:           <field name="flow_stop">True | False</field>
 
494
.. i18n:       </record>
 
495
..
 
496
 
 
497
.. code-block:: xml
 
498
 
 
499
    <record model="workflow.activity" id="''activity_id''">
 
500
          <field name="wkf_id" ref="''workflow_id''"/>
 
501
          <field name="name">''activity.name''</field>::
 
502
 
 
503
          <field name="split_mode">XOR | OR | AND</field>
 
504
          <field name="join_mode">XOR | AND</field>
 
505
          <field name="kind">dummy | function | subflow | stopall</field>
 
506
 
 
507
          <field name="action">''(...)''</field>
 
508
          <field name="signal_send">''(...)''</field>
 
509
          <field name="flow_start">True | False</field>
 
510
          <field name="flow_stop">True | False</field>
 
511
      </record>
 
512
 
 
513
.. i18n: The first two arguments **wkf_id** and name are mandatory.
 
514
..
 
515
 
 
516
The first two arguments **wkf_id** and name are mandatory.
 
517
 
 
518
.. i18n: .. warning::
 
519
.. i18n: 
 
520
.. i18n:     Be warned to not use **flow_start** and **flow_stop** unless your activity
 
521
.. i18n:     really is a **flow start** or **flow_stop**. There are tiny versions that
 
522
.. i18n:     do not care about the tags contents like "True" or "False".
 
523
.. i18n: 
 
524
.. i18n:     This is because tags content are always evaluated as string. Read the
 
525
.. i18n:     section about the :ref:`eval attribute <eval-attribute-link>` for an
 
526
.. i18n:     explanation.
 
527
..
 
528
 
 
529
.. warning::
 
530
 
 
531
    Be warned to not use **flow_start** and **flow_stop** unless your activity
 
532
    really is a **flow start** or **flow_stop**. There are tiny versions that
 
533
    do not care about the tags contents like "True" or "False".
 
534
 
 
535
    This is because tags content are always evaluated as string. Read the
 
536
    section about the :ref:`eval attribute <eval-attribute-link>` for an
 
537
    explanation.
 
538
 
 
539
.. i18n: Examples
 
540
.. i18n: --------
 
541
..
 
542
 
 
543
Examples
 
544
--------
 
545
 
 
546
.. i18n: There are too many possibilities of activity definition to choose from using this definition. We recommend you to have a look at the file **server/bin/addons/sale/sale_workflow.xml** for several examples of activity definitions.
 
547
..
 
548
 
 
549
There are too many possibilities of activity definition to choose from using this definition. We recommend you to have a look at the file **server/bin/addons/sale/sale_workflow.xml** for several examples of activity definitions.
 
550
 
 
551
.. i18n: Transition
 
552
.. i18n: ===========
 
553
..
 
554
 
 
555
Transition
 
556
===========
 
557
 
 
558
.. i18n: Introduction
 
559
.. i18n: ------------
 
560
..
 
561
 
 
562
Introduction
 
563
------------
 
564
 
 
565
.. i18n: Workflow transitions are the conditions to be satisfied to go from one activity to the next one. They are represented by one-way arrows joining two activities.
 
566
..
 
567
 
 
568
Workflow transitions are the conditions to be satisfied to go from one activity to the next one. They are represented by one-way arrows joining two activities.
 
569
 
 
570
.. i18n: The conditions are of different types:
 
571
..
 
572
 
 
573
The conditions are of different types:
 
574
 
 
575
.. i18n:     * role to satisfy by the user
 
576
.. i18n:     * button pressed in the interface
 
577
.. i18n:     * end of a subflow through a selected activity of subflow
 
578
..
 
579
 
 
580
    * role to satisfy by the user
 
581
    * button pressed in the interface
 
582
    * end of a subflow through a selected activity of subflow
 
583
 
 
584
.. i18n: The roles and signals are evaluated before the expression. If a role or a signal is false, the expression will not be evaluated.
 
585
..
 
586
 
 
587
The roles and signals are evaluated before the expression. If a role or a signal is false, the expression will not be evaluated.
 
588
 
 
589
.. i18n: Transition tests may not write values in objects.
 
590
..
 
591
 
 
592
Transition tests may not write values in objects.
 
593
 
 
594
.. i18n: The fields
 
595
.. i18n: ----------
 
596
..
 
597
 
 
598
The fields
 
599
----------
 
600
 
 
601
.. i18n: ::
 
602
.. i18n: 
 
603
.. i18n:     act_from
 
604
..
 
605
 
 
606
::
 
607
 
 
608
    act_from
 
609
 
 
610
.. i18n: Source activity. When this activity is over, the condition is tested to determine if we can start the ACT_TO activity.
 
611
..
 
612
 
 
613
Source activity. When this activity is over, the condition is tested to determine if we can start the ACT_TO activity.
 
614
 
 
615
.. i18n: ::
 
616
.. i18n: 
 
617
.. i18n:     act_to
 
618
..
 
619
 
 
620
::
 
621
 
 
622
    act_to
 
623
 
 
624
.. i18n: The destination activity.
 
625
..
 
626
 
 
627
The destination activity.
 
628
 
 
629
.. i18n: ::
 
630
.. i18n: 
 
631
.. i18n:     condition
 
632
..
 
633
 
 
634
::
 
635
 
 
636
    condition
 
637
 
 
638
.. i18n: **Expression** to be satisfied if we want the transition done.
 
639
..
 
640
 
 
641
**Expression** to be satisfied if we want the transition done.
 
642
 
 
643
.. i18n: ::
 
644
.. i18n: 
 
645
.. i18n:     signal
 
646
..
 
647
 
 
648
::
 
649
 
 
650
    signal
 
651
 
 
652
.. i18n: When the operation of transition comes from a button pressed in the client form, signal tests the name of the pressed button.
 
653
..
 
654
 
 
655
When the operation of transition comes from a button pressed in the client form, signal tests the name of the pressed button.
 
656
 
 
657
.. i18n: If signal is NULL, no button is necessary to validate this transition.
 
658
..
 
659
 
 
660
If signal is NULL, no button is necessary to validate this transition.
 
661
 
 
662
.. i18n: ::
 
663
.. i18n: 
 
664
.. i18n:     role_id
 
665
..
 
666
 
 
667
::
 
668
 
 
669
    role_id
 
670
 
 
671
.. i18n: The **role** that a user must have to validate this transition.
 
672
..
 
673
 
 
674
The **role** that a user must have to validate this transition.
 
675
 
 
676
.. i18n: Defining Transitions Using XML Files
 
677
.. i18n: ------------------------------------
 
678
..
 
679
 
 
680
Defining Transitions Using XML Files
 
681
------------------------------------
 
682
 
 
683
.. i18n: The general structure of a transition record is as follows
 
684
..
 
685
 
 
686
The general structure of a transition record is as follows
 
687
 
 
688
.. i18n: .. code-block:: xml
 
689
.. i18n: 
 
690
.. i18n:     <record model="workflow.transition" id="transition_id">
 
691
.. i18n: 
 
692
.. i18n:         <field name="act_from" ref="activity_id'_1_'"/>
 
693
.. i18n:         <field name="act_to" ref="activity_id'_2_'"/>
 
694
.. i18n: 
 
695
.. i18n:         <field name="signal">(...)</field>
 
696
.. i18n:         <field name="role_id" ref="role_id'_1_'"/>
 
697
.. i18n:         <field name="condition">(...)</field>
 
698
.. i18n: 
 
699
.. i18n:         <field name="trigger_model">(...)</field>
 
700
.. i18n:         <field name="trigger_expr_id">(...)</field>
 
701
.. i18n: 
 
702
.. i18n:     </record>
 
703
..
 
704
 
 
705
.. code-block:: xml
 
706
 
 
707
    <record model="workflow.transition" id="transition_id">
 
708
 
 
709
        <field name="act_from" ref="activity_id'_1_'"/>
 
710
        <field name="act_to" ref="activity_id'_2_'"/>
 
711
 
 
712
        <field name="signal">(...)</field>
 
713
        <field name="role_id" ref="role_id'_1_'"/>
 
714
        <field name="condition">(...)</field>
 
715
 
 
716
        <field name="trigger_model">(...)</field>
 
717
        <field name="trigger_expr_id">(...)</field>
 
718
 
 
719
    </record>
 
720
 
 
721
.. i18n: Only the fields **act_from** and **act_to** are mandatory.
 
722
..
 
723
 
 
724
Only the fields **act_from** and **act_to** are mandatory.
 
725
 
 
726
.. i18n: Expressions
 
727
.. i18n: ===========
 
728
..
 
729
 
 
730
Expressions
 
731
===========
 
732
 
 
733
.. i18n: Expressions are written as in python:
 
734
..
 
735
 
 
736
Expressions are written as in python:
 
737
 
 
738
.. i18n:     * True
 
739
.. i18n:     * 1==1
 
740
.. i18n:     * 'hello' in ['hello','bye']
 
741
..
 
742
 
 
743
    * True
 
744
    * 1==1
 
745
    * 'hello' in ['hello','bye']
 
746
 
 
747
.. i18n: Any field from the resource the workflow refers to can be used in these expressions. For example, if you were creating a workflow for partner addresses, you could use expressions like:
 
748
..
 
749
 
 
750
Any field from the resource the workflow refers to can be used in these expressions. For example, if you were creating a workflow for partner addresses, you could use expressions like:
 
751
 
 
752
.. i18n:     * zip==1400
 
753
.. i18n:     * phone==mobile
 
754
..
 
755
 
 
756
    * zip==1400
 
757
    * phone==mobile
 
758
 
 
759
.. i18n: User Role
 
760
.. i18n: =========
 
761
.. i18n: Roles can be attached to transitions. If a role is given for a transition, that transition can only be executed if the user who triggered it possess the necessary role.
 
762
..
 
763
 
 
764
User Role
 
765
=========
 
766
Roles can be attached to transitions. If a role is given for a transition, that transition can only be executed if the user who triggered it possess the necessary role.
 
767
 
 
768
.. i18n: Each user can have one or several roles. Roles are defined in a tree of roles, parent roles having the rights of all their children.
 
769
..
 
770
 
 
771
Each user can have one or several roles. Roles are defined in a tree of roles, parent roles having the rights of all their children.
 
772
 
 
773
.. i18n: Example:
 
774
..
 
775
 
 
776
Example:
 
777
 
 
778
.. i18n: CEO
 
779
..
 
780
 
 
781
CEO
 
782
 
 
783
.. i18n:   * Technical manager
 
784
.. i18n: 
 
785
.. i18n:     - Lead developer
 
786
..
 
787
 
 
788
  * Technical manager
 
789
 
 
790
    - Lead developer
 
791
 
 
792
.. i18n:       + Developers
 
793
.. i18n:       + Testers
 
794
..
 
795
 
 
796
      + Developers
 
797
      + Testers
 
798
 
 
799
.. i18n:   * Sales manager
 
800
.. i18n: 
 
801
.. i18n:     - Commercials
 
802
.. i18n:     - ...
 
803
..
 
804
 
 
805
  * Sales manager
 
806
 
 
807
    - Commercials
 
808
    - ...
 
809
 
 
810
.. i18n: Let's suppose we handle our own bug database and that the action of marking a bug as valid needs the Testers role. In the example tree above, marking a bug as valid could be done by all the users having the following roles: Testers, Lead developer, Technical manager, CEO.
 
811
..
 
812
 
 
813
Let's suppose we handle our own bug database and that the action of marking a bug as valid needs the Testers role. In the example tree above, marking a bug as valid could be done by all the users having the following roles: Testers, Lead developer, Technical manager, CEO.
 
814
 
 
815
.. i18n: Error handling
 
816
.. i18n: ==============
 
817
..
 
818
 
 
819
Error handling
 
820
==============
 
821
 
 
822
.. i18n: As of this writing, there is no exception handling in workflows.
 
823
..
 
824
 
 
825
As of this writing, there is no exception handling in workflows.
 
826
 
 
827
.. i18n: Workflows being made of several actions executed in batch, they can't trigger exceptions. In order to improve the execution efficiency and to release a maximum of locks, workflows commit at the end of each activity. This approach is reasonable because an activity is only started if the conditions of the transactions are satisfied.
 
828
..
 
829
 
 
830
Workflows being made of several actions executed in batch, they can't trigger exceptions. In order to improve the execution efficiency and to release a maximum of locks, workflows commit at the end of each activity. This approach is reasonable because an activity is only started if the conditions of the transactions are satisfied.
 
831
 
 
832
.. i18n: The only problem comes from exceptions due to programming errors; in that case, only transactions belonging to the entirely completed activities are executed. Other transactions are "rolled back".
 
833
..
 
834
 
 
835
The only problem comes from exceptions due to programming errors; in that case, only transactions belonging to the entirely completed activities are executed. Other transactions are "rolled back".
 
836
 
 
837
.. i18n: Creating a Workflow
 
838
.. i18n: ===================
 
839
..
 
840
 
 
841
Creating a Workflow
 
842
===================
 
843
 
 
844
.. i18n: Steps for creating a simple state-changing workflow for a custom module called **mymod**
 
845
..
 
846
 
 
847
Steps for creating a simple state-changing workflow for a custom module called **mymod**
 
848
 
 
849
.. i18n: Define the States of your object
 
850
.. i18n: --------------------------------
 
851
..
 
852
 
 
853
Define the States of your object
 
854
--------------------------------
 
855
 
 
856
.. i18n: The first step is to define the States your object can be in. We do this by adding a 'state' field to our object, in the _columns collection
 
857
..
 
858
 
 
859
The first step is to define the States your object can be in. We do this by adding a 'state' field to our object, in the _columns collection
 
860
 
 
861
.. i18n: .. code-block:: python
 
862
.. i18n: 
 
863
.. i18n:     _columns = {
 
864
.. i18n:      ...
 
865
.. i18n:         'state': fields.selection([
 
866
.. i18n:         ('new','New'),
 
867
.. i18n:         ('assigned','Assigned'),
 
868
.. i18n:         ('negotiation','Negotiation'),
 
869
.. i18n:         ('won','Won'),
 
870
.. i18n:         ('lost','Lost')], 'Stage', readonly=True),
 
871
.. i18n:     }
 
872
..
 
873
 
 
874
.. code-block:: python
 
875
 
 
876
    _columns = {
 
877
     ...
 
878
        'state': fields.selection([
 
879
        ('new','New'),
 
880
        ('assigned','Assigned'),
 
881
        ('negotiation','Negotiation'),
 
882
        ('won','Won'),
 
883
        ('lost','Lost')], 'Stage', readonly=True),
 
884
    }
 
885
 
 
886
.. i18n: Define the State-change Handling Methods
 
887
.. i18n: ----------------------------------------
 
888
..
 
889
 
 
890
Define the State-change Handling Methods
 
891
----------------------------------------
 
892
 
 
893
.. i18n: Add the following additional methods to your object. These will be called by our workflow buttons
 
894
..
 
895
 
 
896
Add the following additional methods to your object. These will be called by our workflow buttons
 
897
 
 
898
.. i18n: .. code-block:: python
 
899
.. i18n: 
 
900
.. i18n:     def mymod_new(self, cr, uid, ids):
 
901
.. i18n:          self.write(cr, uid, ids, { 'state' : 'new' })
 
902
.. i18n:          return True
 
903
.. i18n: 
 
904
.. i18n:     def mymod_assigned(self, cr, uid, ids):
 
905
.. i18n:          self.write(cr, uid, ids, { 'state' : 'assigned' })
 
906
.. i18n:          return True
 
907
.. i18n: 
 
908
.. i18n:     def mymod_negotiation(self, cr, uid, ids):
 
909
.. i18n:          self.write(cr, uid, ids, { 'state' : 'negotiation' })
 
910
.. i18n:          return True
 
911
.. i18n: 
 
912
.. i18n:     def mymod_won(self, cr, uid, ids):
 
913
.. i18n:          self.write(cr, uid, ids, { 'state' : 'won' })
 
914
.. i18n:          return True
 
915
.. i18n: 
 
916
.. i18n:     def mymod_lost(self, cr, uid, ids):
 
917
.. i18n:          self.write(cr, uid, ids, { 'state' : 'lost' })
 
918
.. i18n:          return True
 
919
..
 
920
 
 
921
.. code-block:: python
 
922
 
 
923
    def mymod_new(self, cr, uid, ids):
 
924
         self.write(cr, uid, ids, { 'state' : 'new' })
 
925
         return True
 
926
 
 
927
    def mymod_assigned(self, cr, uid, ids):
 
928
         self.write(cr, uid, ids, { 'state' : 'assigned' })
 
929
         return True
 
930
 
 
931
    def mymod_negotiation(self, cr, uid, ids):
 
932
         self.write(cr, uid, ids, { 'state' : 'negotiation' })
 
933
         return True
 
934
 
 
935
    def mymod_won(self, cr, uid, ids):
 
936
         self.write(cr, uid, ids, { 'state' : 'won' })
 
937
         return True
 
938
 
 
939
    def mymod_lost(self, cr, uid, ids):
 
940
         self.write(cr, uid, ids, { 'state' : 'lost' })
 
941
         return True
 
942
 
 
943
.. i18n: Obviously you would extend these methods in the future to do something more useful!
 
944
..
 
945
 
 
946
Obviously you would extend these methods in the future to do something more useful!
 
947
 
 
948
.. i18n: Create your Workflow XML file
 
949
.. i18n: -----------------------------
 
950
..
 
951
 
 
952
Create your Workflow XML file
 
953
-----------------------------
 
954
 
 
955
.. i18n: There are three types of records we need to define in a file called mymod_workflow.xml
 
956
..
 
957
 
 
958
There are three types of records we need to define in a file called mymod_workflow.xml
 
959
 
 
960
.. i18n: #. Workflow header record (only one of these)
 
961
..
 
962
 
 
963
#. Workflow header record (only one of these)
 
964
 
 
965
.. i18n:     .. code-block:: xml
 
966
.. i18n: 
 
967
.. i18n:         <record model="workflow" id="wkf_mymod">
 
968
.. i18n:             <field name="name">mymod.wkf</field>
 
969
.. i18n:             <field name="osv">mymod.mymod</field>
 
970
.. i18n:             <field name="on_create">True</field>
 
971
.. i18n:         </record>
 
972
..
 
973
 
 
974
    .. code-block:: xml
 
975
 
 
976
        <record model="workflow" id="wkf_mymod">
 
977
            <field name="name">mymod.wkf</field>
 
978
            <field name="osv">mymod.mymod</field>
 
979
            <field name="on_create">True</field>
 
980
        </record>
 
981
 
 
982
.. i18n: #. Workflow Activity records
 
983
..
 
984
 
 
985
#. Workflow Activity records
 
986
 
 
987
.. i18n:     These define the actions that should be executed when the workflow reaches a particular state
 
988
..
 
989
 
 
990
    These define the actions that should be executed when the workflow reaches a particular state
 
991
 
 
992
.. i18n:     .. code-block:: xml
 
993
.. i18n: 
 
994
.. i18n:         <record model="workflow.activity" id="act_new">
 
995
.. i18n:             <field name="wkf_id" ref="wkf_mymod" />
 
996
.. i18n:             <field name="flow_start">True</field>
 
997
.. i18n:             <field name="name">new</field>
 
998
.. i18n:             <field name="kind">function</field>
 
999
.. i18n:             <field name="action">mymod_new()</field>
 
1000
.. i18n:         </record>
 
1001
.. i18n: 
 
1002
.. i18n:         <record model="workflow.activity" id="act_assigned">
 
1003
.. i18n:             <field name="wkf_id" ref="wkf_mymod" />
 
1004
.. i18n:             <field name="name">assigned</field>
 
1005
.. i18n:             <field name="kind">function</field>
 
1006
.. i18n:             <field name="action">mymod_assigned()</field>
 
1007
.. i18n:         </record>
 
1008
.. i18n: 
 
1009
.. i18n:         <record model="workflow.activity" id="act_negotiation">
 
1010
.. i18n:             <field name="wkf_id" ref="wkf_mymod" />
 
1011
.. i18n:             <field name="name">negotiation</field>
 
1012
.. i18n:             <field name="kind">function</field>
 
1013
.. i18n:             <field name="action">mymod_negotiation()</field>
 
1014
.. i18n:         </record>
 
1015
.. i18n: 
 
1016
.. i18n:         <record model="workflow.activity" id="act_won">
 
1017
.. i18n:             <field name="wkf_id" ref="wkf_mymod" />
 
1018
.. i18n:             <field name="name">won</field>
 
1019
.. i18n:             <field name="kind">function</field>
 
1020
.. i18n:             <field name="action">mymod_won()</field>
 
1021
.. i18n:             <field name="flow_stop">True</field>
 
1022
.. i18n:         </record>
 
1023
.. i18n: 
 
1024
.. i18n:         <record model="workflow.activity" id="act_lost">
 
1025
.. i18n:             <field name="wkf_id" ref="wkf_mymod" />
 
1026
.. i18n:             <field name="name">lost</field>
 
1027
.. i18n:             <field name="kind">function</field>
 
1028
.. i18n:             <field name="action">mymod_lost()</field>
 
1029
.. i18n:             <field name="flow_stop">True</field>
 
1030
.. i18n:         </record>
 
1031
..
 
1032
 
 
1033
    .. code-block:: xml
 
1034
 
 
1035
        <record model="workflow.activity" id="act_new">
 
1036
            <field name="wkf_id" ref="wkf_mymod" />
 
1037
            <field name="flow_start">True</field>
 
1038
            <field name="name">new</field>
 
1039
            <field name="kind">function</field>
 
1040
            <field name="action">mymod_new()</field>
 
1041
        </record>
 
1042
 
 
1043
        <record model="workflow.activity" id="act_assigned">
 
1044
            <field name="wkf_id" ref="wkf_mymod" />
 
1045
            <field name="name">assigned</field>
 
1046
            <field name="kind">function</field>
 
1047
            <field name="action">mymod_assigned()</field>
 
1048
        </record>
 
1049
 
 
1050
        <record model="workflow.activity" id="act_negotiation">
 
1051
            <field name="wkf_id" ref="wkf_mymod" />
 
1052
            <field name="name">negotiation</field>
 
1053
            <field name="kind">function</field>
 
1054
            <field name="action">mymod_negotiation()</field>
 
1055
        </record>
 
1056
 
 
1057
        <record model="workflow.activity" id="act_won">
 
1058
            <field name="wkf_id" ref="wkf_mymod" />
 
1059
            <field name="name">won</field>
 
1060
            <field name="kind">function</field>
 
1061
            <field name="action">mymod_won()</field>
 
1062
            <field name="flow_stop">True</field>
 
1063
        </record>
 
1064
 
 
1065
        <record model="workflow.activity" id="act_lost">
 
1066
            <field name="wkf_id" ref="wkf_mymod" />
 
1067
            <field name="name">lost</field>
 
1068
            <field name="kind">function</field>
 
1069
            <field name="action">mymod_lost()</field>
 
1070
            <field name="flow_stop">True</field>
 
1071
        </record>
 
1072
 
 
1073
.. i18n: #. Workflow Transition records
 
1074
..
 
1075
 
 
1076
#. Workflow Transition records
 
1077
 
 
1078
.. i18n:     These define the possible transitions between workflow states
 
1079
..
 
1080
 
 
1081
    These define the possible transitions between workflow states
 
1082
 
 
1083
.. i18n:     .. code-block:: xml
 
1084
.. i18n: 
 
1085
.. i18n:         <record model="workflow.transition" id="t1">
 
1086
.. i18n:             <field name="act_from" ref="act_new" />
 
1087
.. i18n:             <field name="act_to" ref="act_assigned" />
 
1088
.. i18n:             <field name="signal">mymod_assigned</field>
 
1089
.. i18n:         </record>
 
1090
.. i18n: 
 
1091
.. i18n:         <record model="workflow.transition" id="t2">
 
1092
.. i18n:             <field name="act_from" ref="act_assigned" />
 
1093
.. i18n:             <field name="act_to" ref="act_negotiation" />
 
1094
.. i18n:             <field name="signal">mymod_negotiation</field>
 
1095
.. i18n:         </record>
 
1096
.. i18n: 
 
1097
.. i18n:         <record model="workflow.transition" id="t3">
 
1098
.. i18n:             <field name="act_from" ref="act_negotiation" />
 
1099
.. i18n:             <field name="act_to" ref="act_won" />
 
1100
.. i18n:             <field name="signal">mymod_won</field>
 
1101
.. i18n:         </record>
 
1102
.. i18n: 
 
1103
.. i18n:         <record model="workflow.transition" id="t4">
 
1104
.. i18n:             <field name="act_from" ref="act_negotiation" />
 
1105
.. i18n:             <field name="act_to" ref="act_lost" />
 
1106
.. i18n:             <field name="signal">mymod_lost</field>
 
1107
.. i18n:         </record>
 
1108
..
 
1109
 
 
1110
    .. code-block:: xml
 
1111
 
 
1112
        <record model="workflow.transition" id="t1">
 
1113
            <field name="act_from" ref="act_new" />
 
1114
            <field name="act_to" ref="act_assigned" />
 
1115
            <field name="signal">mymod_assigned</field>
 
1116
        </record>
 
1117
 
 
1118
        <record model="workflow.transition" id="t2">
 
1119
            <field name="act_from" ref="act_assigned" />
 
1120
            <field name="act_to" ref="act_negotiation" />
 
1121
            <field name="signal">mymod_negotiation</field>
 
1122
        </record>
 
1123
 
 
1124
        <record model="workflow.transition" id="t3">
 
1125
            <field name="act_from" ref="act_negotiation" />
 
1126
            <field name="act_to" ref="act_won" />
 
1127
            <field name="signal">mymod_won</field>
 
1128
        </record>
 
1129
 
 
1130
        <record model="workflow.transition" id="t4">
 
1131
            <field name="act_from" ref="act_negotiation" />
 
1132
            <field name="act_to" ref="act_lost" />
 
1133
            <field name="signal">mymod_lost</field>
 
1134
        </record>
 
1135
 
 
1136
.. i18n: Add mymod_workflow.xml to __terp__.py
 
1137
.. i18n: -------------------------------------
 
1138
..
 
1139
 
 
1140
Add mymod_workflow.xml to __terp__.py
 
1141
-------------------------------------
 
1142
 
 
1143
.. i18n: Edit your module's __terp__.py and add mymod_workflow.xml to the "update_xml" array, so that OpenERP picks it up next time your module is loaded.
 
1144
..
 
1145
 
 
1146
Edit your module's __terp__.py and add mymod_workflow.xml to the "update_xml" array, so that OpenERP picks it up next time your module is loaded.
 
1147
 
 
1148
.. i18n: Add Workflow Buttons to your View
 
1149
.. i18n: ---------------------------------
 
1150
..
 
1151
 
 
1152
Add Workflow Buttons to your View
 
1153
---------------------------------
 
1154
 
 
1155
.. i18n: The final step is to add the required buttons to mymod_views.xml file.
 
1156
..
 
1157
 
 
1158
The final step is to add the required buttons to mymod_views.xml file.
 
1159
 
 
1160
.. i18n: Add the following at the end of the <form> section of your object's view definition:
 
1161
..
 
1162
 
 
1163
Add the following at the end of the <form> section of your object's view definition:
 
1164
 
 
1165
.. i18n:     .. code-block:: xml
 
1166
.. i18n: 
 
1167
.. i18n:         <separator string="Workflow Actions" colspan="4"/>
 
1168
.. i18n:         <group colspan="4" col="3">
 
1169
.. i18n:             <button name="mymod_assigned" string="Assigned" states="new" />
 
1170
.. i18n:             <button name="mymod_negotiation" string="In Negotiation" states="assigned" />
 
1171
.. i18n:             <button name="mymod_won" string="Won" states="negotiating" />
 
1172
.. i18n:             <button name="mymod_lost" string="Lost" states="negotiating" />
 
1173
.. i18n:         </group>
 
1174
..
 
1175
 
 
1176
    .. code-block:: xml
 
1177
 
 
1178
        <separator string="Workflow Actions" colspan="4"/>
 
1179
        <group colspan="4" col="3">
 
1180
            <button name="mymod_assigned" string="Assigned" states="new" />
 
1181
            <button name="mymod_negotiation" string="In Negotiation" states="assigned" />
 
1182
            <button name="mymod_won" string="Won" states="negotiating" />
 
1183
            <button name="mymod_lost" string="Lost" states="negotiating" />
 
1184
        </group>
 
1185
 
 
1186
.. i18n: Testing
 
1187
.. i18n: -------
 
1188
.. i18n: Now use the Module Manager to install or update your module. If you have done everything correctly you shouldn't get any errors. You can check if your workflow is installed in the menu :menuselection:`Administration --> Customization --> Workflow Definitions`.
 
1189
..
 
1190
 
 
1191
Testing
 
1192
-------
 
1193
Now use the Module Manager to install or update your module. If you have done everything correctly you shouldn't get any errors. You can check if your workflow is installed in the menu :menuselection:`Administration --> Customization --> Workflow Definitions`.
 
1194
 
 
1195
.. i18n: When you are testing, remember that the workflow will only apply to NEW records that you create.
 
1196
..
 
1197
 
 
1198
When you are testing, remember that the workflow will only apply to NEW records that you create.
 
1199
 
 
1200
.. i18n: Troubleshooting
 
1201
.. i18n: ---------------
 
1202
.. i18n: If your buttons do not seem to be doing anything, one of the following two things are likely:
 
1203
..
 
1204
 
 
1205
Troubleshooting
 
1206
---------------
 
1207
If your buttons do not seem to be doing anything, one of the following two things are likely:
 
1208
 
 
1209
.. i18n:    1. The record you are working on does not have a Workflow Instance record associated with it (it was probably created before you defined your workflow)
 
1210
.. i18n:    2. You have not set the "osv" field correctly in your workflow XML file
 
1211
..
 
1212
 
 
1213
   1. The record you are working on does not have a Workflow Instance record associated with it (it was probably created before you defined your workflow)
 
1214
   2. You have not set the "osv" field correctly in your workflow XML file