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
8e2fad19
Commit
8e2fad19
authored
Jul 27, 2015
by
wenjie.zheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WorkflowTool.py: do not save workflow assignments to chain_by_type.
parent
75b6cdbc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
34 deletions
+20
-34
product/ERP5/Tool/WorkflowTool.py
product/ERP5/Tool/WorkflowTool.py
+20
-34
No files found.
product/ERP5/Tool/WorkflowTool.py
View file @
8e2fad19
...
@@ -189,51 +189,37 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool):
...
@@ -189,51 +189,37 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool):
return
self
.
_invokeWithNotification
(
return
self
.
_invokeWithNotification
(
workflow_list
,
ob
,
action
,
wf
.
doActionFor
,
(
ob
,
action
)
+
args
,
kw
)
workflow_list
,
ob
,
action
,
wf
.
doActionFor
,
(
ob
,
action
)
+
args
,
kw
)
def
getWorkflowValueListForChain
(
self
,
ob
):
def
getWorkflowValueListFor
(
self
,
ob
):
""" add type assigned workflows to _chain_by_type.
""" Return a list of workflows bound to selected object, this workflow
list may contain both DC Workflow and Workflow.
"""
"""
workflow_list
=
[]
if
isinstance
(
ob
,
basestring
):
if
isinstance
(
ob
,
basestring
):
portal_type_id
=
ob
portal_type_id
=
ob
elif
hasattr
(
aq_base
(
ob
),
'getPortalType'
):
elif
hasattr
(
aq_base
(
ob
),
'getPortalType'
):
portal_type_id
=
ob
.
getPortalType
()
portal_type_id
=
ob
.
getPortalType
()
else
:
else
:
portal_type_id
=
None
portal_type_id
=
None
if
portal_type_id
is
not
None
:
portal_type
=
self
.
getPortalObject
().
portal_types
.
_getOb
(
portal_type_id
,
None
)
if
portal_type
is
not
None
:
for
workflow_id
in
portal_type
.
getTypeWorkflowList
():
if
portal_type_id
in
self
.
_chains_by_type
:
if
workflow_id
not
in
self
.
_chains_by_type
[
portal_type_id
]:
self
.
addTypeCBT
(
portal_type_id
,
workflow_id
)
else
:
self
.
_chains_by_type
[
portal_type_id
]
=
(
workflow_id
,)
def
getChainFor
(
self
,
ob
):
if
portal_type_id
is
None
:
""" Get the chain that applies to the given object.
return
workflow_list
"""
# add type assigned workflows to _chain_by_type.
self
.
getWorkflowValueListForChain
(
ob
)
cbt
=
self
.
_chains_by_type
if
isinstance
(
ob
,
basestring
):
pt
=
ob
elif
hasattr
(
aq_base
(
ob
),
'getPortalTypeName'
):
pt
=
ob
.
getPortalTypeName
()
else
:
pt
=
None
if
pt
is
None
:
portal_type
=
self
.
getPortalObject
().
portal_types
.
_getOb
(
portal_type_id
,
None
)
return
()
# Workflow assignment:
if
portal_type
is
not
None
:
for
workflow_id
in
portal_type
.
getTypeWorkflowList
():
workflow_list
.
append
(
self
.
_getOb
(
workflow_id
))
# DCWorkflow assignment
for
wf_id
in
self
.
getChainFor
(
ob
):
wf
=
self
.
getWorkflowById
(
wf_id
)
if
wf
is
not
None
:
workflow_list
.
append
(
wf
)
return
workflow_list
chain
=
None
getWorkflowsFor
=
getWorkflowValueListFor
if
cbt
is
not
None
:
chain
=
cbt
.
get
(
pt
,
None
)
# Note that if chain is not in cbt or has a value of
# None, we use a default chain.
if
chain
is
None
:
return
self
.
getDefaultChain
()
return
chain
security
.
declarePrivate
(
'getHistoryOf'
)
def
getHistoryOf
(
self
,
wf_id
,
ob
):
def
getHistoryOf
(
self
,
wf_id
,
ob
):
""" Get the history of an object for a given workflow.
""" Get the history of an object for a given workflow.
"""
"""
...
...
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