1 | """Workflow: entrada_workflow |
---|
2 | """ |
---|
3 | |
---|
4 | # Copyright (c) 2005 by Interlegis |
---|
5 | # |
---|
6 | |
---|
7 | # Generator: ArchGenXML Version 1.4.0-RC2 svn/development |
---|
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 | |
---|
28 | from Products.CMFCore.utils import getToolByName |
---|
29 | from Products.CMFCore.WorkflowTool import addWorkflowFactory |
---|
30 | from Products.DCWorkflow.DCWorkflow import DCWorkflowDefinition |
---|
31 | from 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 | |
---|
37 | productname = 'ILSAALMaterial' |
---|
38 | |
---|
39 | def setupentrada_workflow(self, workflow): |
---|
40 | """Define the entrada_workflow workflow. |
---|
41 | """ |
---|
42 | |
---|
43 | workflow.setProperties(title='entrada_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', 'entradaPendente', 'cancelado', 'lancadoEstoqueTotal', 'lancadoEstoqueParcial']: |
---|
50 | workflow.states.addState(s) |
---|
51 | |
---|
52 | for t in ['salvar', 'cancelar', 'finalizarTotal', 'finalizarParcial']: |
---|
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['entradaPendente'] |
---|
76 | stateDef.setProperties(title="""entradaPendente""", |
---|
77 | transitions=['cancelar', 'finalizarTotal', 'finalizarParcial']) |
---|
78 | |
---|
79 | stateDef = workflow.states['cancelado'] |
---|
80 | stateDef.setProperties(title="""cancelado""", |
---|
81 | transitions=[]) |
---|
82 | |
---|
83 | stateDef = workflow.states['lancadoEstoqueTotal'] |
---|
84 | stateDef.setProperties(title="""lancadoEstoqueTotal""", |
---|
85 | transitions=[]) |
---|
86 | |
---|
87 | stateDef = workflow.states['lancadoEstoqueParcial'] |
---|
88 | stateDef.setProperties(title="""lancadoEstoqueParcial""", |
---|
89 | transitions=[]) |
---|
90 | |
---|
91 | ## Transitions initialization |
---|
92 | |
---|
93 | transitionDef = workflow.transitions['salvar'] |
---|
94 | transitionDef.setProperties(title="""salvar""", |
---|
95 | new_state_id="""entradaPendente""", |
---|
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['cancelar'] |
---|
106 | transitionDef.setProperties(title="""cancelar""", |
---|
107 | new_state_id="""cancelado""", |
---|
108 | trigger_type=1, |
---|
109 | script_name="""""", |
---|
110 | after_script_name="""""", |
---|
111 | actbox_name="""cancelar""", |
---|
112 | actbox_url="""""", |
---|
113 | actbox_category="""workflow""", |
---|
114 | props={}, |
---|
115 | ) |
---|
116 | |
---|
117 | transitionDef = workflow.transitions['finalizarTotal'] |
---|
118 | transitionDef.setProperties(title="""finalizarTotal""", |
---|
119 | new_state_id="""lancadoEstoqueTotal""", |
---|
120 | trigger_type=1, |
---|
121 | script_name="""""", |
---|
122 | after_script_name="""""", |
---|
123 | actbox_name="""finalizarTotal""", |
---|
124 | actbox_url="""""", |
---|
125 | actbox_category="""workflow""", |
---|
126 | props={}, |
---|
127 | ) |
---|
128 | |
---|
129 | transitionDef = workflow.transitions['finalizarParcial'] |
---|
130 | transitionDef.setProperties(title="""finalizarParcial""", |
---|
131 | new_state_id="""lancadoEstoqueParcial""", |
---|
132 | trigger_type=1, |
---|
133 | script_name="""""", |
---|
134 | after_script_name="""""", |
---|
135 | actbox_name="""finalizarParcial""", |
---|
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 | |
---|
201 | def createentrada_workflow(self, id): |
---|
202 | """Create the workflow for ILSAALMaterial. |
---|
203 | """ |
---|
204 | |
---|
205 | ob = DCWorkflowDefinition(id) |
---|
206 | setupentrada_workflow(self, ob) |
---|
207 | return ob |
---|
208 | |
---|
209 | addWorkflowFactory(createentrada_workflow, |
---|
210 | id='entrada_workflow', |
---|
211 | title='entrada_workflow') |
---|
212 | |
---|
213 | ##code-section create-workflow-module-footer #fill in your manual code here |
---|
214 | ##/code-section create-workflow-module-footer |
---|
215 | |
---|