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
Papa Tamsir Kane
erp5
Commits
bc0a91ac
Commit
bc0a91ac
authored
May 06, 2015
by
wenjie.zheng
Committed by
Sebastien Robin
Jul 16, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
patches/WorkflowTool.py: deploy universal methods.
parent
3d838a2c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
45 deletions
+10
-45
product/ERP5Type/patches/WorkflowTool.py
product/ERP5Type/patches/WorkflowTool.py
+10
-45
No files found.
product/ERP5Type/patches/WorkflowTool.py
View file @
bc0a91ac
...
@@ -1037,25 +1037,12 @@ def _isJumpToStatePossibleFor(self, ob, state_id, wf_id=None):
...
@@ -1037,25 +1037,12 @@ def _isJumpToStatePossibleFor(self, ob, state_id, wf_id=None):
return
False
return
False
def
_doActionFor
(
self
,
ob
,
action
,
wf_id
=
None
,
*
args
,
**
kw
):
def
_doActionFor
(
self
,
ob
,
action
,
wf_id
=
None
,
*
args
,
**
kw
):
wfs
=
self
.
getWorkflowsFor
(
ob
)
workflow_list
=
self
.
getWorkflowValueListFor
(
ob
.
getPortalType
())
workflow_list
=
ob
.
getTypeInfo
().
getTypeERP5WorkflowList
()
case
=
1
if
wfs
is
None
or
wf_id
in
workflow_list
:
wfs
=
()
case
=
2
if
wf_id
is
None
:
if
wf_id
is
None
:
if
w
fs
==
()
and
w
orkflow_list
==
[]:
if
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
workflow_list
:
if
wf
.
isActionSupported
(
ob
,
action
,
**
kw
):
found
=
1
case
=
1
break
for
workflow_id
in
workflow_list
:
wf
=
self
.
getPortalObject
().
getDefaultModule
(
'Workflow'
).
_getOb
(
workflow_id
)
if
wf
.
isActionSupported
(
ob
,
action
,
**
kw
):
if
wf
.
isActionSupported
(
ob
,
action
,
**
kw
):
found
=
1
found
=
1
case
=
2
case
=
2
...
@@ -1063,41 +1050,23 @@ def _doActionFor(self, ob, action, wf_id=None, *args, **kw):
...
@@ -1063,41 +1050,23 @@ def _doActionFor(self, ob, action, wf_id=None, *args, **kw):
if
not
found
:
if
not
found
:
msg
=
_
(
u"No workflow provides the '${action_id}' action."
,
mapping
=
{
'action_id'
:
action
})
msg
=
_
(
u"No workflow provides the '${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
)
else
:
wf
=
self
.
getPortalObject
().
getDefaultModule
(
'Workflow'
).
_getOb
(
wf_id
,
None
)
if
wf
is
None
:
if
wf
is
None
:
raise
WorkflowException
(
_
(
u'Requested workflow definition not found.'
))
raise
WorkflowException
(
_
(
u'Requested workflow definition not found.'
))
return
self
.
_invokeWithNotification
(
if
case
==
1
:
workflow_list
,
ob
,
action
,
wf
.
doActionFor
,
(
ob
,
action
)
+
args
,
kw
)
return
self
.
_invokeWithNotification
(
wfs
,
ob
,
action
,
wf
.
doActionFor
,
(
ob
,
action
)
+
args
,
kw
)
else
:
return
wf
.
doActionFor
(
ob
,
action
)
def
_getInfoFor
(
self
,
ob
,
name
,
default
=
_marker
,
wf_id
=
None
,
*
args
,
**
kw
):
def
_getInfoFor
(
self
,
ob
,
name
,
default
=
_marker
,
wf_id
=
None
,
*
args
,
**
kw
):
wfs
=
self
.
getWorkflowsFor
(
ob
)
workflow_list
=
self
.
getWorkflowValueListFor
(
ob
.
getPortalType
())
workflow_list
=
ob
.
getTypeInfo
().
getTypeERP5WorkflowList
()
case
=
1
if
wfs
is
None
or
wf_id
in
workflow_list
:
case
=
2
if
wf_id
is
None
:
if
wf_id
is
None
:
if
w
fs
is
None
and
w
orkflow_list
==
[]:
if
workflow_list
==
[]:
if
default
is
_marker
:
if
default
is
_marker
:
raise
WorkflowException
(
_
(
u'No workflows found.'
))
raise
WorkflowException
(
_
(
u'No workflows found.'
))
else
:
else
:
return
default
return
default
found
=
0
found
=
0
for
wf
in
wfs
:
for
workflow
in
workflow_list
:
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
):
if
workflow
.
isInfoSuported
(
ob
,
name
):
found
=
1
found
=
1
case
=
2
case
=
2
...
@@ -1110,10 +1079,7 @@ def _getInfoFor(self, ob, name, default=_marker, wf_id=None, *args, **kw):
...
@@ -1110,10 +1079,7 @@ def _getInfoFor(self, ob, name, default=_marker, wf_id=None, *args, **kw):
else
:
else
:
return
default
return
default
else
:
else
:
if
case
==
1
:
wf
=
self
.
getWorkflowById
(
wf_id
)
wf
=
self
.
getWorkflowById
(
wf_id
)
else
:
wf
=
self
.
getPortalObject
().
getDefaultModule
(
'Workflow'
).
_getOb
(
wf_id
)
if
wf
is
None
:
if
wf
is
None
:
if
default
is
_marker
:
if
default
is
_marker
:
raise
WorkflowException
(
raise
WorkflowException
(
...
@@ -1126,7 +1092,6 @@ def _getInfoFor(self, ob, name, default=_marker, wf_id=None, *args, **kw):
...
@@ -1126,7 +1092,6 @@ def _getInfoFor(self, ob, name, default=_marker, wf_id=None, *args, **kw):
msg
=
_
(
u'Could not get info: ${name}'
,
mapping
=
{
'name'
:
name
})
msg
=
_
(
u'Could not get info: ${name}'
,
mapping
=
{
'name'
:
name
})
raise
WorkflowException
(
msg
)
raise
WorkflowException
(
msg
)
return
res
return
res
WorkflowTool
.
_jumpToStateFor
=
_jumpToStateFor
WorkflowTool
.
_jumpToStateFor
=
_jumpToStateFor
WorkflowTool
.
_isJumpToStatePossibleFor
=
_isJumpToStatePossibleFor
WorkflowTool
.
_isJumpToStatePossibleFor
=
_isJumpToStatePossibleFor
WorkflowTool
.
doActionFor
=
_doActionFor
WorkflowTool
.
doActionFor
=
_doActionFor
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