Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Lukas Niegsch
erp5
Commits
e363bc5e
Commit
e363bc5e
authored
Jun 23, 2015
by
wenjie.zheng
Committed by
Sebastien Robin
Jul 16, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Workflow.py: add worklist showAsXML.
parent
b6ed8014
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
3 deletions
+39
-3
product/ERP5Workflow/Document/Workflow.py
product/ERP5Workflow/Document/Workflow.py
+39
-3
No files found.
product/ERP5Workflow/Document/Workflow.py
View file @
e363bc5e
...
@@ -886,7 +886,7 @@ class Workflow(IdAsReferenceMixin("workflow_", "prefix"), XMLObject):
...
@@ -886,7 +886,7 @@ class Workflow(IdAsReferenceMixin("workflow_", "prefix"), XMLObject):
transition
=
SubElement
(
transitions
,
'transition'
,
transition
=
SubElement
(
transitions
,
'transition'
,
attrib
=
dict
(
reference
=
tdef
.
getReference
(),
attrib
=
dict
(
reference
=
tdef
.
getReference
(),
portal_type
=
tdef
.
getPortalType
()))
portal_type
=
tdef
.
getPortalType
()))
guard
=
SubElement
(
transition
,
'guard'
,
attrib
=
dict
(
type
=
'
string
'
))
guard
=
SubElement
(
transition
,
'guard'
,
attrib
=
dict
(
type
=
'
object
'
))
for
property_id
in
sorted
(
transition_prop_id_to_show
):
for
property_id
in
sorted
(
transition_prop_id_to_show
):
if
property_id
==
'new_state_id'
:
if
property_id
==
'new_state_id'
:
if
tdef
.
getDestinationValue
()
is
not
None
:
if
tdef
.
getDestinationValue
()
is
not
None
:
...
@@ -961,17 +961,53 @@ class Workflow(IdAsReferenceMixin("workflow_", "prefix"), XMLObject):
...
@@ -961,17 +961,53 @@ class Workflow(IdAsReferenceMixin("workflow_", "prefix"), XMLObject):
sub_object
=
SubElement
(
variable
,
property_id
,
attrib
=
dict
(
type
=
property_type
))
sub_object
=
SubElement
(
variable
,
property_id
,
attrib
=
dict
(
type
=
property_type
))
sub_object
.
text
=
str
(
property_value
)
sub_object
.
text
=
str
(
property_value
)
"""
# 4. Worklist as XML
# 4. Worklist as XML
worklist_reference_list
=
[]
worklist_reference_list
=
[]
worklist_list
=
self
.
objectValues
(
portal_type
=
'Worklist'
)
worklist_list
=
self
.
objectValues
(
portal_type
=
'Worklist'
)
worklist_prop_id_to_show
=
[
'description'
,
'matched_portal_type_list'
,
'matched_validation_state_list'
,
'matched_simulation_state_list'
,
'actbox_category'
,
'actbox_name'
,
'actbox_url'
,
'actbox_icon'
,
'roles'
,
'groups'
,
'permissions'
,
'expr'
]
for
qdef
in
worklist_list
:
for
qdef
in
worklist_list
:
worklist_reference_list
.
append
(
qdef
.
getReference
())
worklist_reference_list
.
append
(
qdef
.
getReference
())
worklists
=
SubElement
(
workflow
,
'worklists'
,
attrib
=
dict
(
worklist_list
=
str
(
worklist_reference_list
),
worklists
=
SubElement
(
workflow
,
'worklists'
,
attrib
=
dict
(
worklist_list
=
str
(
worklist_reference_list
),
number_of_element
=
str
(
len
(
worklist_reference_list
))))
number_of_element
=
str
(
len
(
worklist_reference_list
))))
for
qdef
in
worklist_list
:
for
qdef
in
worklist_list
:
worklist = SubElement(worklists, 'worklist', attrib=dict(reference=qdef.getReference()))
worklist
=
SubElement
(
worklists
,
'worklist'
,
attrib
=
dict
(
reference
=
qdef
.
getReference
(),
portal_type
=
qdef
.
getPortalType
()))
guard
=
SubElement
(
worklist
,
'guard'
,
attrib
=
dict
(
type
=
'object'
))
for
property_id
in
sorted
(
worklist_prop_id_to_show
):
# show guard configuration:
if
property_id
in
(
'roles'
,
'groups'
,
'permissions'
,
'expr'
,):
if
property_id
==
'roles'
:
property_value
=
qdef
.
getRoleList
()
if
property_id
==
'groups'
:
property_value
=
qdef
.
getGroupList
()
if
property_id
==
'permissions'
:
property_value
=
qdef
.
getPermissionList
()
if
property_id
==
'expr'
:
property_value
=
qdef
.
getExpression
()
if
property_value
is
None
or
property_value
==
[]:
property_value
=
''
sub_object
=
SubElement
(
guard
,
property_id
,
attrib
=
dict
(
type
=
'guard configuration'
))
else
:
property_value
=
qdef
.
getProperty
(
property_id
)
state_ref_list
=
[]
if
property_id
in
(
'matched_validation_state_list'
,
'matched_simulation_state_list'
,)
and
property_value
is
not
None
:
for
sid
in
property_value
:
state_ref
=
self
.
_getOb
(
sid
).
getReference
()
state_ref_list
.
append
(
state_ref
)
property_value
=
tuple
(
state_ref_list
)
if
property_id
==
'matched_portal_type_list'
:
property_value
=
tuple
(
property_value
)
if
property_value
is
None
:
property_value
=
''
property_type
=
qdef
.
getPropertyType
(
property_id
)
sub_object
=
SubElement
(
worklist
,
property_id
,
attrib
=
dict
(
type
=
property_type
))
sub_object
.
text
=
str
(
property_value
)
"""
# 5. Script as XML
# 5. Script as XML
script_reference_list = []
script_reference_list = []
script_list = self.objectValues(portal_type='Workflow Script')
script_list = self.objectValues(portal_type='Workflow Script')
...
...
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