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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Eteri
erp5
Commits
49ae3287
Commit
49ae3287
authored
Mar 19, 2015
by
wenjie.zheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
patches/WOrkflowTool.py: add ERP5Workflow compatibility to getInfoFor.
parent
9c909ece
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
1 deletion
+52
-1
product/ERP5Type/patches/WorkflowTool.py
product/ERP5Type/patches/WorkflowTool.py
+52
-1
No files found.
product/ERP5Type/patches/WorkflowTool.py
View file @
49ae3287
...
...
@@ -38,6 +38,8 @@ from itertools import izip
from
MySQLdb
import
ProgrammingError
,
OperationalError
from
DateTime
import
DateTime
_marker
=
[]
# Create a new marker object.
def
DCWorkflowDefinition_notifyWorkflowMethod
(
self
,
ob
,
transition_list
,
args
=
None
,
kw
=
None
):
'''
Allows the system to request a workflow action. This method
...
...
@@ -961,7 +963,6 @@ def _isJumpToStatePossibleFor(self, ob, state_id, wf_id=None):
return
True
return
False
def
_doActionFor
(
self
,
ob
,
action
,
wf_id
=
None
,
*
args
,
**
kw
):
wfs
=
self
.
getWorkflowsFor
(
ob
)
workflow_list
=
ob
.
getTypeInfo
().
getTypeERP5WorkflowList
()
...
...
@@ -1003,6 +1004,56 @@ def _doActionFor(self, ob, action, wf_id=None, *args, **kw):
else
:
return
workflow
.
doActionFor
(
ob
,
action
)
def
_getInfoFor
(
self
,
ob
,
name
,
default
=
_marker
,
wf_id
=
None
,
*
args
,
**
kw
):
wfs
=
self
.
getWorkflowsFor
(
ob
)
workflow_list
=
ob
.
getTypeInfo
().
getTypeERP5WorkflowList
()
case
=
1
if
wfs
is
None
:
case
=
2
if
wf_id
is
None
:
if
wfs
is
None
and
workflow_list
==
[]:
if
default
is
_marker
:
raise
WorkflowException
(
_
(
u'No workflows found.'
))
else
:
return
default
found
=
0
for
wf
in
wfs
:
if
wf
.
isInfoSupported
(
ob
,
name
):
found
=
1
case
=
1
break
for
workflow_id
in
workflow_list
:
workflow
=
self
.
getPortalObject
().
getDefaultModule
(
'Workflow'
).
_getOb
(
workflow_id
)
if
workflow
.
isInfoSuported
(
ob
,
name
):
found
=
1
case
=
2
break
if
not
found
:
if
default
is
_marker
:
msg
=
_
(
u"No workflow provides '${name}' information."
,
mapping
=
{
'name'
:
name
})
raise
WorkflowException
(
msg
)
else
:
return
default
else
:
if
case
==
1
:
wf
=
self
.
getWorkflowById
(
wf_id
)
else
:
wf
=
self
.
getPortalObject
().
getDefaultModule
(
'Workflow'
).
_getOb
(
wf_id
)
if
wf
is
None
:
if
default
is
_marker
:
raise
WorkflowException
(
_
(
u'Requested workflow definition not found.'
))
else
:
return
default
res
=
wf
.
getInfoFor
(
ob
,
name
,
default
,
*
args
,
**
kw
)
if
res
is
_marker
:
msg
=
_
(
u'Could not get info: ${name}'
,
mapping
=
{
'name'
:
name
})
raise
WorkflowException
(
msg
)
return
res
WorkflowTool
.
_jumpToStateFor
=
_jumpToStateFor
WorkflowTool
.
_isJumpToStatePossibleFor
=
_isJumpToStatePossibleFor
WorkflowTool
.
doActionFor
=
_doActionFor
WorkflowTool
.
getInfoFor
=
_getInfoFor
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