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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Sebastien Robin
erp5
Commits
6f7223dd
Commit
6f7223dd
authored
Oct 25, 2016
by
iv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ERP5Workflow: use get...List methods
parent
b97ae55e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
9 deletions
+9
-9
product/ERP5Workflow/Document/Workflow.py
product/ERP5Workflow/Document/Workflow.py
+9
-9
No files found.
product/ERP5Workflow/Document/Workflow.py
View file @
6f7223dd
...
@@ -306,7 +306,7 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
...
@@ -306,7 +306,7 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
_
(
u'Requested workflow not found.'
))
_
(
u'Requested workflow not found.'
))
tdef
=
self
.
_getOb
(
id
=
action
)
tdef
=
self
.
_getOb
(
id
=
action
)
if
tdef
not
in
self
.
objectValues
(
portal_type
=
'Transition'
):
if
tdef
not
in
self
.
getTransitionValueList
(
):
raise
Unauthorized
(
action
)
raise
Unauthorized
(
action
)
if
tdef
is
None
or
tdef
.
getTriggerType
()
!=
TRIGGER_USER_ACTION
:
if
tdef
is
None
or
tdef
.
getTriggerType
()
!=
TRIGGER_USER_ACTION
:
msg
=
_
(
u"Transition '${action_id}' is not triggered by a user "
msg
=
_
(
u"Transition '${action_id}' is not triggered by a user "
...
@@ -378,7 +378,7 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
...
@@ -378,7 +378,7 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
(worklist id as key) and which value is a dict composed of
(worklist id as key) and which value is a dict composed of
variable matches.
variable matches.
"""
"""
if
not
self
.
objectValues
(
portal_type
=
'Worklist'
):
if
not
self
.
getWorklistValueList
(
):
return
None
return
None
portal
=
self
.
getPortalObject
()
portal
=
self
.
getPortalObject
()
...
@@ -549,7 +549,7 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
...
@@ -549,7 +549,7 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
return
'transition_'
+
transition_reference
return
'transition_'
+
transition_reference
def
getScriptIdByReference
(
self
,
script_reference
):
def
getScriptIdByReference
(
self
,
script_reference
):
return
'script_'
+
script_reference
return
SCRIPT_PREFIX
+
script_reference
def
getWorklistValueById
(
self
,
worklist_reference
):
def
getWorklistValueById
(
self
,
worklist_reference
):
return
self
.
_getOb
(
'worklist_'
+
worklist_reference
,
None
)
return
self
.
_getOb
(
'worklist_'
+
worklist_reference
,
None
)
...
@@ -858,7 +858,7 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
...
@@ -858,7 +858,7 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
# 1. State as XML
# 1. State as XML
state_reference_list
=
[]
state_reference_list
=
[]
state_list
=
self
.
objectValues
(
portal_type
=
'State'
)
state_list
=
self
.
getStateValueList
(
)
# show reference instead of id
# show reference instead of id
state_prop_id_to_show
=
[
'description'
,
state_prop_id_to_show
=
[
'description'
,
'transitions'
,
'permission_roles'
]
'transitions'
,
'permission_roles'
]
...
@@ -890,12 +890,12 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
...
@@ -890,12 +890,12 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
# 2. Transition as XML
# 2. Transition as XML
transition_reference_list
=
[]
transition_reference_list
=
[]
transition_list
=
self
.
objectValues
(
portal_type
=
'Transition'
)
transition_list
=
self
.
getTransitionValueList
(
)
transition_prop_id_to_show
=
[
'description'
,
'new_state_id'
,
transition_prop_id_to_show
=
[
'description'
,
'new_state_id'
,
'trigger_type'
,
'script_name'
,
'after_script_name'
,
'action_type'
,
'trigger_type'
,
'script_name'
,
'after_script_name'
,
'action_type'
,
'icon'
,
'action_name'
,
'action'
,
'roles'
,
'groups'
,
'icon'
,
'action_name'
,
'action'
,
'roles'
,
'groups'
,
'permissions'
,
'expr'
,
'transition_variable'
]
'permissions'
,
'expr'
,
'transition_variable'
]
for
tdef
in
self
.
objectValues
(
portal_type
=
'Transition'
)
:
for
tdef
in
transition_list
:
transition_reference_list
.
append
(
tdef
.
getReference
())
transition_reference_list
.
append
(
tdef
.
getReference
())
transitions
=
SubElement
(
workflow
,
'transitions'
,
transitions
=
SubElement
(
workflow
,
'transitions'
,
attrib
=
dict
(
transition_list
=
str
(
transition_reference_list
),
attrib
=
dict
(
transition_list
=
str
(
transition_reference_list
),
...
@@ -991,7 +991,7 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
...
@@ -991,7 +991,7 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
# 4. Worklist as XML
# 4. Worklist as XML
worklist_reference_list
=
[]
worklist_reference_list
=
[]
worklist_list
=
self
.
objectValues
(
portal_type
=
'Worklist'
)
worklist_list
=
self
.
getWorklistValueList
(
)
worklist_prop_id_to_show
=
[
'description'
,
'matched_portal_type_list'
,
worklist_prop_id_to_show
=
[
'description'
,
'matched_portal_type_list'
,
'matched_validation_state_list'
,
'matched_simulation_state_list'
,
'matched_validation_state_list'
,
'matched_simulation_state_list'
,
'action_type'
,
'action_name'
,
'action'
,
'icon'
,
'action_type'
,
'action_name'
,
'action'
,
'icon'
,
...
@@ -1038,7 +1038,7 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
...
@@ -1038,7 +1038,7 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
# 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
.
getScriptValueList
(
)
script_prop_id_to_show
=
sorted
([
'body'
,
'parameter_signature'
,
'proxy_roles'
])
script_prop_id_to_show
=
sorted
([
'body'
,
'parameter_signature'
,
'proxy_roles'
])
for
sdef
in
script_list
:
for
sdef
in
script_list
:
script_reference_list
.
append
(
sdef
.
getReference
())
script_reference_list
.
append
(
sdef
.
getReference
())
...
@@ -1195,7 +1195,7 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
...
@@ -1195,7 +1195,7 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
self
.
workflow_managed_permission
=
permission_list
self
.
workflow_managed_permission
=
permission_list
# add/remove the added/removed workflow permission to each state
# add/remove the added/removed workflow permission to each state
for
state
in
self
.
objectValues
(
portal_type
=
'State'
):
for
state
in
self
.
getStateValueList
(
):
state
.
setCellRange
(
sorted
(
permission_list
),
state
.
setCellRange
(
sorted
(
permission_list
),
sorted
(
self
.
getManagedRoleList
()),
sorted
(
self
.
getManagedRoleList
()),
base_id
=
'cell'
)
base_id
=
'cell'
)
...
...
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