Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
erp5_workflow
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wenjie.zheng
erp5_workflow
Commits
b1f324a8
Commit
b1f324a8
authored
Oct 07, 2015
by
wenjie.zheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
testWorklist.py: add new workflow compatibility.
parent
287c3ae4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
58 additions
and
11 deletions
+58
-11
product/ERP5/tests/testWorklist.py
product/ERP5/tests/testWorklist.py
+58
-11
No files found.
product/ERP5/tests/testWorklist.py
View file @
b1f324a8
...
...
@@ -26,9 +26,9 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
import
re
import
unittest
from
zLOG
import
LOG
,
INFO
,
WARNING
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
Testing.ZopeTestCase.PortalTestCase
import
PortalTestCase
...
...
@@ -156,27 +156,74 @@ class TestWorklist(ERP5TypeTestCase):
# add new workflow compatibility
workflow_value
=
self
.
getWorkflowTool
()[
workflow_id
]
if
workflow_value
.
__class__
.
__name__
==
'Workflow'
:
variable_value
=
workflow_value
.
newContent
(
id
=
'variable_'
+
variable_id
,
portal_type
=
'Variable'
)
variable_value
.
setReference
(
variable_id
)
# Will add dynamic variable in worklist.
pass
else
:
variables
=
workflow_value
.
variables
variables
.
addVariable
(
variable_id
)
variable_value
=
variables
[
variable_id
]
assert
variable_value
.
for_catalog
==
1
assert
variable_value
.
for_catalog
==
1
def
createWorklist
(
self
,
workflow_id
,
worklist_id
,
actbox_name
,
actbox_url
=
None
,
**
kw
):
# add new workflow compatibility
tales_re
=
re
.
compile
(
r'(\
w+:)?(.*)
')
workflow_value = self.getWorkflowTool()[workflow_id]
if workflow_value.__class__.__name__ == '
Workflow
':
worklist_value = workflow_value.newContent(portal_type='
Worklist
')
worklist_value.setReference(worklist_id)
worklist_value
.
setProperties
(
''
,
actbox_name
=
'%s (%%(count)s)'
%
actbox_name
,
actbox_url
=
actbox_url
,
props
=
{
k
if
k
.
startswith
(
'guard_'
)
else
'variable_'
+
k
:
v
for
k
,
v
in
kw
.
iteritems
()})
worklist_value
.
updateDynamicVariable
()
# Configure new workflow:
actbox_name='
%
s
(
%%
(
count
)
s
)
' % actbox_name
worklist_value.setActboxName(str(actbox_name))
worklist_value.setActboxUrl(str(actbox_url))
worklist_value.setActboxCategory(str('
global
'))
props={k if k.startswith('
guard_
') else '
variable_
' + k: v
for k, v in kw.iteritems()}
if '
variable_portal_type
' in props:
v = props.get('
variable_portal_type
', None)
if v:
worklist_value.setMatchedPortalTypeList(v)
if '
variable_validation_state
' in props:
v = props.get('
variable_validation_state
', None)
if v:
worklist_value.setMatchedValidationState('
state_
'+v)
if '
variable_
' + self.int_catalogued_variable_id in props:
variable_ref = self.int_catalogued_variable_id
v = props.get('
variable_
'+self.int_catalogued_variable_id, None)
if v:
# Add a local worklist variable:
variable_value = worklist_value._getOb('
variable_
' + self.int_catalogued_variable_id, None)
if variable_value is None:
variable_value = worklist_value.newContent(portal_type='
Worklist
Variable
')
variable_value.setReference(variable_ref)
variable_value.setInitialValue(str(v))
# test04 related key
if '
variable_region_uid
' in props:
v = props.get('
variable_region_uid
', None)
if v:
variable_value = worklist_value._getOb('
variable_region_uid
', None)
if variable_value is None:
variable_value = worklist_value.newContent(portal_type='
Worklist
Variable
')
variable_value.setReference('
region_uid
')
variable_value.setDefaultExpr(v)
if '
variable_base_category_id
' in props:
variable_value = worklist_value._getOb('
variable_base_category_id
', None)
v = props.get('
variable_base_category_id
', None)
if variable_value is None:
variable_value = worklist_value.newContent(portal_type='
Worklist
Variable
')
variable_value.setReference('
base_category_id
')
variable_value.setInitialValue(v)
# Update guard configuration for view and guard value.
if '
guard_roles
' in props:
v = props.get('
guard_roles
', '')
if v:
worklist_value.setRoleList([ var.strip() for var in v.split('
;
') ])
if '
guard_expr
' in props:
v = props.get('
guard_expr
', '')
if v:
worklist_value.setExpression(v)
worklist_value.getGuard()
else:
worklists = workflow_value.worklists
worklists.addWorklist(worklist_id)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment