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
Mikolaï Krol
erp5
Commits
dab41b23
Commit
dab41b23
authored
Mar 17, 2015
by
wenjie.zheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
patches/WorkflowTool.py: add doActionFor's compability.
parent
3a625816
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
25 deletions
+42
-25
product/ERP5Type/patches/WorkflowTool.py
product/ERP5Type/patches/WorkflowTool.py
+42
-25
No files found.
product/ERP5Type/patches/WorkflowTool.py
View file @
dab41b23
...
@@ -25,7 +25,7 @@ from Products.CMFCore.WorkflowCore import ObjectMoved, ObjectDeleted
...
@@ -25,7 +25,7 @@ from Products.CMFCore.WorkflowCore import ObjectMoved, ObjectDeleted
from
Products.CMFCore.WorkflowCore
import
WorkflowException
from
Products.CMFCore.WorkflowCore
import
WorkflowException
from
Products.DCWorkflow.DCWorkflow
import
DCWorkflowDefinition
from
Products.DCWorkflow.DCWorkflow
import
DCWorkflowDefinition
from
Products.DCWorkflow.Transitions
import
TRIGGER_WORKFLOW_METHOD
from
Products.DCWorkflow.Transitions
import
TRIGGER_WORKFLOW_METHOD
from
Products.CMFCore.utils
import
Message
as
_
from
Products.CMFCore.utils
import
getToolByName
from
Products.CMFCore.utils
import
getToolByName
from
Products.ZSQLCatalog.SQLCatalog
import
SimpleQuery
,
AutoQuery
,
ComplexQuery
,
NegatedQuery
from
Products.ZSQLCatalog.SQLCatalog
import
SimpleQuery
,
AutoQuery
,
ComplexQuery
,
NegatedQuery
from
Products.CMFCore.utils
import
_getAuthenticatedUser
from
Products.CMFCore.utils
import
_getAuthenticatedUser
...
@@ -961,32 +961,49 @@ def _isJumpToStatePossibleFor(self, ob, state_id, wf_id=None):
...
@@ -961,32 +961,49 @@ def _isJumpToStatePossibleFor(self, ob, state_id, wf_id=None):
return
True
return
True
return
False
return
False
def
_doActionFor
(
self
,
ob
,
action
,
wf_id
=
None
,
*
args
,
**
kw
):
def
_doActionFor
(
self
,
ob
,
action
,
wf_id
=
None
,
*
args
,
**
kw
):
""" Perform the given workflow action on 'ob'.
###raise NotImplementedError ("Redefine doActionFor") ###zwj: it workfs!
"""
wfs
=
self
.
getWorkflowsFor
(
ob
)
###raise NotImplementedError ("Redefine doActionFor") ###zwj: it workfs!
workflow_list
=
ob
.
getTypeInfo
().
getTypeERP5WorkflowList
()
wfs
=
self
.
getWorkflowsFor
(
ob
)
case
=
1
if
wfs
is
None
:
wfs
=
()
if
wfs
is
None
:
if
wf_id
is
None
:
wfs
=
()
if
not
wfs
:
case
=
2
raise
WorkflowException
(
_
(
u'No workflows found.'
))
found
=
0
if
wf_id
is
None
:
for
wf
in
wfs
:
if
wfs
==
()
and
workflow_list
==
[]:
if
wf
.
isActionSupported
(
ob
,
action
,
**
kw
):
raise
WorkflowException
(
_
(
u'No workflows found.'
))
found
=
1
found
=
0
break
for
wf
in
wfs
:
if
not
found
:
if
wf
.
isActionSupported
(
ob
,
action
,
**
kw
):
msg
=
_
(
u"No workflow provides the '${action_id}' action."
,
found
=
1
mapping
=
{
'action_id'
:
action
})
case
=
1
raise
WorkflowException
(
msg
)
break
for
workflow_id
in
workflow_list
:
workflow
=
self
.
getPortalObject
().
getDefaultModule
(
'Workflow'
).
_getOb
(
workflow_id
)
if
workflow
.
isActionSupported
(
ob
,
action
,
**
kw
):
found
=
1
case
=
2
break
if
not
found
:
msg
=
_
(
u"No workflow provides the '${action_id}' action."
,
mapping
=
{
'action_id'
:
action
})
raise
WorkflowException
(
msg
)
else
:
if
case
==
1
:
wf
=
self
.
getWorkflowById
(
wf_id
)
#wf = getattr(self, 'getWorkflowById', None)(wf_id)
else
:
else
:
wf
=
self
.
getWorkflowById
(
wf_id
)
workflow
=
self
.
getPortalObject
().
getDefaultModule
(
'Workflow'
).
_getOb
(
wf_id
,
None
)
if
wf
is
None
:
if
wf
is
None
and
workflow
is
None
:
raise
WorkflowException
(
raise
WorkflowException
(
_
(
u'Requested workflow definition not found.'
))
_
(
u'Requested workflow definition not found.'
))
return
self
.
_invokeWithNotification
(
if
case
==
1
:
wfs
,
ob
,
action
,
wf
.
doActionFor
,
(
ob
,
action
)
+
args
,
kw
)
return
self
.
_invokeWithNotification
(
wfs
,
ob
,
action
,
wf
.
doActionFor
,
(
ob
,
action
)
+
args
,
kw
)
else
:
return
workflow
.
doActionFor
(
ob
,
action
)
WorkflowTool
.
_jumpToStateFor
=
_jumpToStateFor
WorkflowTool
.
_jumpToStateFor
=
_jumpToStateFor
WorkflowTool
.
_isJumpToStatePossibleFor
=
_isJumpToStatePossibleFor
WorkflowTool
.
_isJumpToStatePossibleFor
=
_isJumpToStatePossibleFor
...
...
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