source: publico/ILSAALMaterial/trunk/Extensions/itemEntrada_workflow.py @ 1540

Última Alteração nesse arquivo desde 1540 foi 1540, incluída por joaoantonio, 14 anos atrás

novo codigo gerado

File size: 8.5 KB
Linha 
1"""Workflow: itemEntrada_workflow
2"""
3
4# Copyright (c) 2005 by Interlegis
5#
6
7# Generator: ArchGenXML Version 1.4.0-RC1 devel
8#            http://plone.org/products/archgenxml
9#
10# GNU General Public Licence (GPL)
11#
12# This program is free software; you can redistribute it and/or modify it under
13# the terms of the GNU General Public License as published by the Free Software
14# Foundation; either version 2 of the License, or (at your option) any later
15# version.
16# This program is distributed in the hope that it will be useful, but WITHOUT
17# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
19# details.
20# You should have received a copy of the GNU General Public License along with
21# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
22# Place, Suite 330, Boston, MA  02111-1307  USA
23#
24__author__    = '''STC Interlegis <stc@interlegis.gov.br>'''
25__docformat__ = 'plaintext'
26__version__   = '$ Revision 0.0 $'[11:-2]
27
28from Products.CMFCore.utils import getToolByName
29from Products.CMFCore.WorkflowTool import addWorkflowFactory
30from Products.DCWorkflow.DCWorkflow import DCWorkflowDefinition
31from Products.ExternalMethod.ExternalMethod import ExternalMethod
32
33##code-section create-workflow-module-header #fill in your manual code here
34##/code-section create-workflow-module-header
35
36
37productname = 'ILSAALMaterial'
38
39def setupitemEntrada_workflow(self, workflow):
40    """Define the itemEntrada_workflow workflow.
41    """
42
43    workflow.setProperties(title='itemEntrada_workflow')
44
45    ##code-section create-workflow-setup-method-header #fill in your manual code here
46    ##/code-section create-workflow-setup-method-header
47
48
49    for s in ['novo', 'itemCadastrado', 'cancelado', 'lancadoEstoque', 'estornado']:
50        workflow.states.addState(s)
51
52    for t in ['salvar', 'finalizarEstoque', 'cancelar', 'estornarEstoque']:
53        workflow.transitions.addTransition(t)
54
55    for v in ['review_history', 'comments', 'time', 'actor', 'action']:
56        workflow.variables.addVariable(v)
57
58    for p in []:
59        workflow.addManagedPermission(p)
60
61    for l in []:
62        if not l in workflow.worklists.objectValues():
63            workflow.worklists.addWorklist(l)
64
65    ## Initial State
66
67    workflow.states.setInitialState('novo')
68
69    ## States initialization
70
71    stateDef = workflow.states['novo']
72    stateDef.setProperties(title="""novo""",
73                           transitions=['salvar'])
74
75    stateDef = workflow.states['itemCadastrado']
76    stateDef.setProperties(title="""itemCadastrado""",
77                           transitions=['cancelar', 'finalizarEstoque', 'estornarEstoque'])
78
79    stateDef = workflow.states['cancelado']
80    stateDef.setProperties(title="""cancelado""",
81                           transitions=[])
82
83    stateDef = workflow.states['lancadoEstoque']
84    stateDef.setProperties(title="""lancadoEstoque""",
85                           transitions=[])
86
87    stateDef = workflow.states['estornado']
88    stateDef.setProperties(title="""estornado""",
89                           transitions=[])
90
91    ## Transitions initialization
92
93    transitionDef = workflow.transitions['salvar']
94    transitionDef.setProperties(title="""salvar""",
95                                new_state_id="""itemCadastrado""",
96                                trigger_type=1,
97                                script_name="""""",
98                                after_script_name="""""",
99                                actbox_name="""salvar""",
100                                actbox_url="""""",
101                                actbox_category="""workflow""",
102                                props={},
103                                )
104
105    transitionDef = workflow.transitions['finalizarEstoque']
106    transitionDef.setProperties(title="""finalizarEstoque""",
107                                new_state_id="""lancadoEstoque""",
108                                trigger_type=1,
109                                script_name="""""",
110                                after_script_name="""""",
111                                actbox_name="""finalizarEstoque""",
112                                actbox_url="""""",
113                                actbox_category="""workflow""",
114                                props={},
115                                )
116
117    transitionDef = workflow.transitions['cancelar']
118    transitionDef.setProperties(title="""cancelar""",
119                                new_state_id="""cancelado""",
120                                trigger_type=1,
121                                script_name="""""",
122                                after_script_name="""""",
123                                actbox_name="""cancelar""",
124                                actbox_url="""""",
125                                actbox_category="""workflow""",
126                                props={},
127                                )
128
129    transitionDef = workflow.transitions['estornarEstoque']
130    transitionDef.setProperties(title="""estornarEstoque""",
131                                new_state_id="""estornado""",
132                                trigger_type=1,
133                                script_name="""""",
134                                after_script_name="""""",
135                                actbox_name="""estornarEstoque""",
136                                actbox_url="""""",
137                                actbox_category="""workflow""",
138                                props={},
139                                )
140
141    ## State Variable
142    workflow.variables.setStateVar('review_state')
143
144    ## Variables initialization
145    variableDef = workflow.variables['review_history']
146    variableDef.setProperties(description="""Provides access to workflow history""",
147                              default_value="""""",
148                              default_expr="""state_change/getHistory""",
149                              for_catalog=0,
150                              for_status=0,
151                              update_always=0,
152                              props={'guard_permissions': 'Request review; Review portal content'})
153
154    variableDef = workflow.variables['comments']
155    variableDef.setProperties(description="""Comments about the last transition""",
156                              default_value="""""",
157                              default_expr="""python:state_change.kwargs.get('comment', '')""",
158                              for_catalog=0,
159                              for_status=1,
160                              update_always=1,
161                              props=None)
162
163    variableDef = workflow.variables['time']
164    variableDef.setProperties(description="""Time of the last transition""",
165                              default_value="""""",
166                              default_expr="""state_change/getDateTime""",
167                              for_catalog=0,
168                              for_status=1,
169                              update_always=1,
170                              props=None)
171
172    variableDef = workflow.variables['actor']
173    variableDef.setProperties(description="""The ID of the user who performed the last transition""",
174                              default_value="""""",
175                              default_expr="""user/getId""",
176                              for_catalog=0,
177                              for_status=1,
178                              update_always=1,
179                              props=None)
180
181    variableDef = workflow.variables['action']
182    variableDef.setProperties(description="""The last transition""",
183                              default_value="""""",
184                              default_expr="""transition/getId|nothing""",
185                              for_catalog=0,
186                              for_status=1,
187                              update_always=1,
188                              props=None)
189
190    ## Worklists Initialization
191
192
193    # WARNING: below protected section is deprecated.
194    # Add a tagged value 'worklist' with the worklist name to your state(s) instead.
195
196    ##code-section create-workflow-setup-method-footer #fill in your manual code here
197    ##/code-section create-workflow-setup-method-footer
198
199
200
201def createitemEntrada_workflow(self, id):
202    """Create the workflow for ILSAALMaterial.
203    """
204
205    ob = DCWorkflowDefinition(id)
206    setupitemEntrada_workflow(self, ob)
207    return ob
208
209addWorkflowFactory(createitemEntrada_workflow,
210                   id='itemEntrada_workflow',
211                   title='itemEntrada_workflow')
212
213##code-section create-workflow-module-footer #fill in your manual code here
214##/code-section create-workflow-module-footer
215
Note: Veja TracBrowser para ajuda no uso do navegador do trac.
 

The contents and data of this website are published under license:
Creative Commons 4.0 Brasil - Atribuir Fonte - Compartilhar Igual.