source: publico/ILSAALMaterial/trunk/Extensions/fornecedor_worflow.py @ 1306

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

Codigo do modelo gerado

File size: 6.8 KB
Linha 
1"""Workflow: fornecedor_worflow
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 setupfornecedor_worflow(self, workflow):
40    """Define the fornecedor_worflow workflow.
41    """
42
43    workflow.setProperties(title='fornecedor_worflow')
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', 'ativo', 'inativo']:
50        workflow.states.addState(s)
51
52    for t in ['salvar', 'inativar']:
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['ativo']
76    stateDef.setProperties(title="""ativo""",
77                           transitions=['inativar'])
78
79    stateDef = workflow.states['inativo']
80    stateDef.setProperties(title="""inativo""",
81                           transitions=[])
82
83    ## Transitions initialization
84
85    transitionDef = workflow.transitions['salvar']
86    transitionDef.setProperties(title="""salvar""",
87                                new_state_id="""ativo""",
88                                trigger_type=1,
89                                script_name="""""",
90                                after_script_name="""""",
91                                actbox_name="""salvar""",
92                                actbox_url="""""",
93                                actbox_category="""workflow""",
94                                props={},
95                                )
96
97    transitionDef = workflow.transitions['inativar']
98    transitionDef.setProperties(title="""inativar""",
99                                new_state_id="""inativo""",
100                                trigger_type=1,
101                                script_name="""""",
102                                after_script_name="""""",
103                                actbox_name="""inativar""",
104                                actbox_url="""""",
105                                actbox_category="""workflow""",
106                                props={},
107                                )
108
109    ## State Variable
110    workflow.variables.setStateVar('review_state')
111
112    ## Variables initialization
113    variableDef = workflow.variables['review_history']
114    variableDef.setProperties(description="""Provides access to workflow history""",
115                              default_value="""""",
116                              default_expr="""state_change/getHistory""",
117                              for_catalog=0,
118                              for_status=0,
119                              update_always=0,
120                              props={'guard_permissions': 'Request review; Review portal content'})
121
122    variableDef = workflow.variables['comments']
123    variableDef.setProperties(description="""Comments about the last transition""",
124                              default_value="""""",
125                              default_expr="""python:state_change.kwargs.get('comment', '')""",
126                              for_catalog=0,
127                              for_status=1,
128                              update_always=1,
129                              props=None)
130
131    variableDef = workflow.variables['time']
132    variableDef.setProperties(description="""Time of the last transition""",
133                              default_value="""""",
134                              default_expr="""state_change/getDateTime""",
135                              for_catalog=0,
136                              for_status=1,
137                              update_always=1,
138                              props=None)
139
140    variableDef = workflow.variables['actor']
141    variableDef.setProperties(description="""The ID of the user who performed the last transition""",
142                              default_value="""""",
143                              default_expr="""user/getId""",
144                              for_catalog=0,
145                              for_status=1,
146                              update_always=1,
147                              props=None)
148
149    variableDef = workflow.variables['action']
150    variableDef.setProperties(description="""The last transition""",
151                              default_value="""""",
152                              default_expr="""transition/getId|nothing""",
153                              for_catalog=0,
154                              for_status=1,
155                              update_always=1,
156                              props=None)
157
158    ## Worklists Initialization
159
160
161    # WARNING: below protected section is deprecated.
162    # Add a tagged value 'worklist' with the worklist name to your state(s) instead.
163
164    ##code-section create-workflow-setup-method-footer #fill in your manual code here
165    ##/code-section create-workflow-setup-method-footer
166
167
168
169def createfornecedor_worflow(self, id):
170    """Create the workflow for ILSAALMaterial.
171    """
172
173    ob = DCWorkflowDefinition(id)
174    setupfornecedor_worflow(self, ob)
175    return ob
176
177addWorkflowFactory(createfornecedor_worflow,
178                   id='fornecedor_worflow',
179                   title='fornecedor_worflow')
180
181##code-section create-workflow-module-footer #fill in your manual code here
182##/code-section create-workflow-module-footer
183
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.