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
Matevz Golob
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
Show 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!
###raise NotImplementedError ("Redefine doActionFor") ###zwj: it workfs!
wfs
=
self
.
getWorkflowsFor
(
ob
)
wfs
=
self
.
getWorkflowsFor
(
ob
)
workflow_list
=
ob
.
getTypeInfo
().
getTypeERP5WorkflowList
()
case
=
1
if
wfs
is
None
:
if
wfs
is
None
:
wfs
=
()
wfs
=
()
case
=
2
if
wf_id
is
None
:
if
wf_id
is
None
:
if
not
wfs
:
if
wfs
==
()
and
workflow_list
==
[]
:
raise
WorkflowException
(
_
(
u'No workflows found.'
))
raise
WorkflowException
(
_
(
u'No workflows found.'
))
found
=
0
found
=
0
for
wf
in
wfs
:
for
wf
in
wfs
:
if
wf
.
isActionSupported
(
ob
,
action
,
**
kw
):
if
wf
.
isActionSupported
(
ob
,
action
,
**
kw
):
found
=
1
found
=
1
case
=
1
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
break
if
not
found
:
if
not
found
:
msg
=
_
(
u"No workflow provides the '${action_id}' action."
,
msg
=
_
(
u"No workflow provides the '${action_id}' action."
,
mapping
=
{
'action_id'
:
action
})
mapping
=
{
'action_id'
:
action
})
raise
WorkflowException
(
msg
)
raise
WorkflowException
(
msg
)
else
:
else
:
if
case
==
1
:
wf
=
self
.
getWorkflowById
(
wf_id
)
wf
=
self
.
getWorkflowById
(
wf_id
)
if
wf
is
None
:
#wf = getattr(self, 'getWorkflowById', None)(wf_id)
raise
WorkflowException
(
else
:
_
(
u'Requested workflow definition not found.'
))
workflow
=
self
.
getPortalObject
().
getDefaultModule
(
'Workflow'
).
_getOb
(
wf_id
,
None
)
return
self
.
_invokeWithNotification
(
if
wf
is
None
and
workflow
is
None
:
wfs
,
ob
,
action
,
wf
.
doActionFor
,
(
ob
,
action
)
+
args
,
kw
)
raise
WorkflowException
(
_
(
u'Requested workflow definition not found.'
))
if
case
==
1
:
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