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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Papa Tamsir Kane
erp5
Commits
2d0365f5
Commit
2d0365f5
authored
Jun 24, 2015
by
wenjie.zheng
Committed by
Sebastien Robin
Jul 16, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ERP5/InteracgtionWorkflow.py: add interaction showAsXML.
parent
7efcf199
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
0 deletions
+43
-0
product/ERP5/InteractionWorkflow.py
product/ERP5/InteractionWorkflow.py
+43
-0
No files found.
product/ERP5/InteractionWorkflow.py
View file @
2d0365f5
...
...
@@ -389,6 +389,49 @@ class InteractionWorkflowDefinition (DCWorkflowDefinition, ActiveObject):
sub_object
.
text
=
str
(
prop_value
)
# 1. Interaction as XML
interaction_reference_list
=
[]
interaction_id_list
=
sorted
(
self
.
interactions
.
keys
())
interaction_prop_id_to_show
=
{
'actbox_category'
:
'string'
,
'actbox_url'
:
'string'
,
'actbox_name'
:
'string'
,
'activate_script_name'
:
'string'
,
'after_script_name'
:
'string'
,
'before_commit_script_name'
:
'string'
,
'description'
:
'text'
,
'guard'
:
'object'
,
'method_id'
:
'string'
,
'once_per_transaction'
:
'string'
,
'portal_type_filter'
:
'string'
,
'portal_type_group_filter'
:
'string'
,
'script_name'
:
'string'
,
'temporary_document_disallowed'
:
'string'
,
'trigger_type'
:
'string'
}
for
tid
in
interaction_id_list
:
interaction_reference_list
.
append
(
tid
)
interactions
=
SubElement
(
interaction_workflow
,
'interactions'
,
attrib
=
dict
(
interaction_list
=
str
(
interaction_reference_list
),
number_of_element
=
str
(
len
(
interaction_reference_list
))))
for
tid
in
interaction_id_list
:
tdef
=
self
.
interactions
[
tid
]
interaction
=
SubElement
(
interactions
,
'interaction'
,
attrib
=
dict
(
reference
=
tdef
.
getReference
(),
portal_type
=
'Interaction'
))
guard
=
SubElement
(
interaction
,
'guard'
,
attrib
=
dict
(
type
=
'object'
))
for
property_id
in
sorted
(
interaction_prop_id_to_show
):
# creationg guard
if
property_id
==
'guard'
:
for
prop_id
in
sorted
([
'groups'
,
'permissions'
,
'expr'
,
'roles'
]):
guard_obj
=
getattr
(
tdef
,
'guard'
)
if
guard_obj
is
not
None
:
prop_value
=
guard_obj
.
__dict__
[
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
)
# no-property definded action box configuration
elif
property_id
in
sorted
([
'actbox_name'
,
'actbox_url'
,
'actbox_category'
]):
property_value
=
getattr
(
tdef
,
property_id
,
None
)
sub_object
=
SubElement
(
interaction
,
property_id
,
attrib
=
dict
(
type
=
'string'
))
else
:
property_value
=
tdef
.
__dict__
[
property_id
]
property_type
=
interaction_prop_id_to_show
[
property_id
]
sub_object
=
SubElement
(
interaction
,
property_id
,
attrib
=
dict
(
type
=
property_type
))
if
property_value
is
None
or
property_value
==
[]
or
property_value
==
():
property_value
=
''
sub_object
.
text
=
str
(
property_value
)
# 2. Variable as XML
variable_reference_list
=
[]
...
...
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