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
Hamza
erp5
Commits
4fa6996c
Commit
4fa6996c
authored
Jun 07, 2015
by
wenjie.zheng
Committed by
Sebastien Robin
Jul 16, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WorkflowTool.py: deal with PermissionRoles cell objects.
parent
d9f69c8f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
3 deletions
+40
-3
product/ERP5/Tool/ERP5WorkflowTool.py
product/ERP5/Tool/ERP5WorkflowTool.py
+27
-2
product/ERP5/Tool/WorkflowTool.py
product/ERP5/Tool/WorkflowTool.py
+13
-1
No files found.
product/ERP5/Tool/ERP5WorkflowTool.py
View file @
4fa6996c
...
...
@@ -297,7 +297,7 @@ class ERP5WorkflowTool(BaseTool, OriginalWorkflowTool):
transition
.
setActboxUrl
(
tdef
.
actbox_url
)
transition
.
setAfterScriptId
(
tdef
.
after_script_name
)
transition
.
setBeforeScriptId
(
tdef
.
script_name
)
transition
.
setDestination
(
tdef
.
new_state_id
)
transition
.
setDestination
(
tdef
.
new_state_id
)
# need to be redefined to category setter
transition
.
guard
=
tdef
.
guard
# create states (portal_type = State)
for
sid
in
dc_workflow
.
states
:
...
...
@@ -307,7 +307,32 @@ class ERP5WorkflowTool(BaseTool, OriginalWorkflowTool):
state
.
edit
(
title
=
sdef
.
title
)
state
.
setReference
(
sdef
.
id
)
state
.
setStatePermissionRoles
(
sdef
.
permission_roles
)
state
.
setDestinationList
(
sdef
.
transitions
)
state
.
setDestinationList
(
sdef
.
transitions
)
# need to be redefined to category setter
# Set Workflow default state using category setter
state_path
=
getattr
(
workflow
,
'state_'
+
dc_workflow
.
initial_state
).
getPath
()
state_path
=
'source'
+
'/'
.
join
(
state_path
.
split
(
'/'
)[
2
:])
LOG
(
"default state path is '%s'"
%
state_path
,
WARNING
,
" in WorkflowTool.py"
)
workflow
.
setCategoryList
(
workflow
.
getCategoryList
()
+
(
state_path
,
))
# set state possible transitions:
for
sid
in
dc_workflow
.
states
:
sdef
=
workflow
.
_getOb
(
'state_'
+
sid
)
destination_category_list
=
[]
for
dc_tr
in
dc_workflow
.
states
.
get
(
sid
).
transitions
:
tr_path
=
getattr
(
workflow
,
'transition_'
+
dc_tr
).
getPath
()
LOG
(
"possible transition path is '%s'"
%
state_path
,
WARNING
,
" in WorkflowTool.py"
)
destination_category_list
.
append
(
'destination'
+
'/'
.
join
(
tr_path
.
split
(
'/'
)[
2
:]))
sdef
.
setCategoryList
(
sdef
.
getCategoryList
()
+
tuple
(
destination_category_list
))
# set transition destination state:
for
tid
in
dc_workflow
.
transitions
:
tdef
=
workflow
.
_getOb
(
'transition_'
+
tid
)
state_path
=
getattr
(
workflow
,
'transition_'
+
dc_workflow
.
transitions
.
get
(
tid
).
new_state_id
).
getPath
()
state_path
=
'destination'
+
'/'
.
join
(
state_path
.
split
(
'/'
)[
2
:])
LOG
(
"destination state path is '%s'"
%
state_path
,
WARNING
,
" in WorkflowTool.py"
)
tdef
.
setCategoryList
(
sdef
.
getCategoryList
()
+
(
state_path
,
))
# create worklists (portal_type = Worklist)
for
qid
in
dc_workflow
.
worklists
:
qdef
=
dc_workflow
.
worklists
.
get
(
qid
)
...
...
product/ERP5/Tool/WorkflowTool.py
View file @
4fa6996c
...
...
@@ -332,7 +332,19 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool):
state
=
workflow
.
newContent
(
portal_type
=
'State'
,
temp_object
=
temp
)
state
.
edit
(
title
=
sdef
.
title
)
state
.
setReference
(
sdef
.
id
)
state
.
setStatePermissionRoles
(
sdef
.
permission_roles
)
permission_roles
=
sdef
.
permission_roles
state
.
setStatePermissionRoles
(
permission_roles
)
LOG
(
"permission_roles is '%s'"
%
permission_roles
,
WARNING
,
"in WorkflowTool.py"
)
i
=
-
1
for
permission
in
workflow
.
getWorkflowManagedPermissionList
():
i
=
i
+
1
j
=
-
1
for
role
in
workflow
.
getRoleList
():
j
=
j
+
1
pr_cell
=
state
.
newContent
(
id
=
'cell_%s_%s'
%
(
i
,
j
),
portal_type
=
'PermissionRoles'
)
if
permission
in
permission_roles
and
role
in
permission_roles
[
permission
]:
pr_cell
.
is_selected
=
1
LOG
(
"cell id is '%s, %s', permission role is '%s, %s', is_selected is %s"
%
(
i
,
j
,
permission
,
role
,
pr_cell
.
is_selected
),
WARNING
,
"in WorkflowTool.py 344"
)
# Set Workflow default state using category setter
state_path
=
getattr
(
workflow
,
'state_'
+
dc_workflow
.
initial_state
).
getPath
()
...
...
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