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
1
Issues
1
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
Roque
erp5
Commits
b6ed8014
Commit
b6ed8014
authored
Jun 23, 2015
by
wenjie.zheng
Committed by
Sebastien Robin
Jul 16, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
patches/DCWorkflow.py: patch worklist showAsXML.
parent
e41b3b8c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
1 deletion
+52
-1
product/ERP5Type/patches/DCWorkflow.py
product/ERP5Type/patches/DCWorkflow.py
+52
-1
No files found.
product/ERP5Type/patches/DCWorkflow.py
View file @
b6ed8014
...
...
@@ -966,7 +966,7 @@ def DCWorkflowDefinition_showAsXML(self, root=None):
tdef
=
self
.
transitions
[
tid
]
transition
=
SubElement
(
transitions
,
'transition'
,
attrib
=
dict
(
reference
=
tid
,
portal_type
=
'Transition'
))
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
):
if
property_id
==
'new_state_id'
:
property_value
=
tdef
.
__dict__
[
'new_state_id'
]
...
...
@@ -1026,6 +1026,57 @@ def DCWorkflowDefinition_showAsXML(self, root=None):
sub_object
=
SubElement
(
variable
,
property_id
,
attrib
=
dict
(
type
=
property_type
))
sub_object
.
text
=
str
(
property_value
)
# 3. Worklist as XML
worklist_reference_list
=
[]
worklist_id_list
=
sorted
(
self
.
worklists
.
keys
())
worklist_prop_id_to_show
=
{
'description'
:
'text'
,
'matched_portal_type_list'
:
'text'
,
'matched_validation_state_list'
:
'string'
,
'matched_simulation_state_list'
:
'string'
,
'actbox_category'
:
'string'
,
'actbox_name'
:
'string'
,
'actbox_url'
:
'string'
,
'actbox_icon'
:
'string'
,
'guard'
:
'object'
}
for
qid
in
worklist_id_list
:
worklist_reference_list
.
append
(
qid
)
worklists
=
SubElement
(
workflow
,
'worklists'
,
attrib
=
dict
(
worklist_list
=
str
(
worklist_reference_list
),
number_of_element
=
str
(
len
(
worklist_reference_list
))))
for
qid
in
worklist_id_list
:
qdef
=
self
.
worklists
[
qid
]
worklist
=
SubElement
(
worklists
,
'worklist'
,
attrib
=
dict
(
reference
=
qdef
.
getReference
(),
portal_type
=
'Worklist'
))
guard
=
SubElement
(
worklist
,
'guard'
,
attrib
=
dict
(
type
=
'object'
))
var_matches
=
qdef
.
__dict__
[
'var_matches'
]
for
property_id
in
sorted
(
worklist_prop_id_to_show
):
if
property_id
==
'guard'
:
guard_obj
=
getattr
(
qdef
,
'guard'
,
None
)
guard_prop_to_show
=
sorted
({
'roles'
:
'guard configuration'
,
'groups'
:
'guard configuration'
,
'permissions'
:
'guard configuration'
,
'expr'
:
'guard configuration'
})
for
prop_id
in
guard_prop_to_show
:
if
guard_obj
is
not
None
:
prop_value
=
getattr
(
guard_obj
,
prop_id
,
''
)
else
:
prop_value
=
''
guard_config
=
SubElement
(
guard
,
prop_id
,
attrib
=
dict
(
type
=
'guard configuration'
))
if
prop_value
is
None
or
prop_value
==
():
prop_value
=
''
guard_config
.
text
=
str
(
prop_value
)
else
:
if
property_id
==
'matched_portal_type_list'
:
var_id
=
'portal_type'
property_value
=
var_matches
.
get
(
var_id
)
elif
property_id
==
'matched_validation_state_list'
:
var_id
=
'validation_state'
property_value
=
var_matches
.
get
(
var_id
)
elif
property_id
==
'matched_simulation_state_list'
:
var_id
=
'simulation_state'
property_value
=
var_matches
.
get
(
var_id
)
else
:
property_value
=
getattr
(
qdef
,
property_id
)
if
property_value
is
None
:
property_value
=
''
property_type
=
worklist_prop_id_to_show
[
property_id
]
sub_object
=
SubElement
(
worklist
,
property_id
,
attrib
=
dict
(
type
=
property_type
))
sub_object
.
text
=
str
(
property_value
)
# return xml object
if
return_as_object
:
return
root
...
...
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