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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
iv
erp5
Commits
0a361ce6
Commit
0a361ce6
authored
Oct 10, 2016
by
iv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ERP5Workflow: rename and clean doActionFor and isActionSupported
parent
915a2451
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
16 deletions
+11
-16
product/ERP5Workflow/Document/Workflow.py
product/ERP5Workflow/Document/Workflow.py
+7
-8
product/ERP5Workflow/Tool/WorkflowTool.py
product/ERP5Workflow/Tool/WorkflowTool.py
+4
-8
No files found.
product/ERP5Workflow/Document/Workflow.py
View file @
0a361ce6
...
@@ -182,15 +182,14 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
...
@@ -182,15 +182,14 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
Returns a true value if the given action name
Returns a true value if the given action name
is possible in the current state.
is possible in the current state.
'''
'''
s
def
=
self
.
_getWorkflowStateOf
(
document
,
id_only
=
0
)
s
tate
=
self
.
_getWorkflowStateOf
(
document
,
id_only
=
0
)
if
s
def
is
None
:
if
s
tate
is
None
:
return
0
return
0
if
action
in
state
.
getDestinationIdList
():
if
action
in
sdef
.
getDestinationIdList
():
transition
=
self
.
_getOb
(
action
,
None
)
tdef
=
self
.
_getOb
(
action
,
None
)
if
(
transition
is
not
None
and
if
(
tdef
is
not
None
and
transition
.
getTriggerType
()
==
TRIGGER_USER_ACTION
and
tdef
.
getTriggerType
()
==
TRIGGER_USER_ACTION
and
self
.
_checkTransitionGuard
(
transition
,
document
,
**
kw
)):
self
.
_checkTransitionGuard
(
tdef
,
document
,
**
kw
)):
return
1
return
1
return
0
return
0
...
...
product/ERP5Workflow/Tool/WorkflowTool.py
View file @
0a361ce6
...
@@ -191,17 +191,13 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool):
...
@@ -191,17 +191,13 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool):
def
doActionFor
(
self
,
ob
,
action
,
wf_id
=
None
,
*
args
,
**
kw
):
def
doActionFor
(
self
,
ob
,
action
,
wf_id
=
None
,
*
args
,
**
kw
):
workflow_list
=
self
.
getWorkflowsFor
(
ob
.
getPortalType
())
workflow_list
=
self
.
getWorkflowsFor
(
ob
.
getPortalType
())
action_ref
=
action
if
wf_id
is
None
:
if
wf_id
is
None
:
if
workflow_list
==
[]:
if
workflow_list
==
[]:
raise
WorkflowException
(
_
(
u'No workflows found.'
))
raise
WorkflowException
(
_
(
u'No workflows found.'
))
found
=
0
found
=
0
for
wf
in
workflow_list
:
for
wf
in
workflow_list
:
if
wf
.
getPortalType
()
==
'Workflow'
:
if
wf
.
getPortalType
()
==
'Workflow'
:
# workflow compatibility
action
=
'transition_'
+
action
action
=
'transition_'
+
action_ref
else
:
action
=
action_ref
if
wf
.
isActionSupported
(
ob
,
action
,
**
kw
):
if
wf
.
isActionSupported
(
ob
,
action
,
**
kw
):
found
=
1
found
=
1
break
break
...
@@ -213,10 +209,10 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool):
...
@@ -213,10 +209,10 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool):
if
wf
is
None
:
if
wf
is
None
:
raise
WorkflowException
(
_
(
u'Requested workflow definition not found.'
))
raise
WorkflowException
(
_
(
u'Requested workflow definition not found.'
))
if
wf
.
getPortalType
()
==
'Workflow'
:
if
wf
.
getPortalType
()
==
'Workflow'
:
# workflow compatibility
action
=
'transition_'
+
action
action
=
'transition_'
+
action_ref
result
=
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
)
return
result
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getWorkflowValueListFor'
)
'getWorkflowValueListFor'
)
...
...
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