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
40f1a34a
Commit
40f1a34a
authored
Sep 13, 2016
by
iv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ERP5Workflow: move copyWorkflow from a test to WorkflowTool
parent
24f587a8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
17 deletions
+21
-17
bt5/erp5_workflow_test/TestTemplateItem/portal_components/test.erp5.testWorkflowAndDCWorkflow.py
.../portal_components/test.erp5.testWorkflowAndDCWorkflow.py
+3
-17
product/ERP5Workflow/Tool/WorkflowTool.py
product/ERP5Workflow/Tool/WorkflowTool.py
+18
-0
No files found.
bt5/erp5_workflow_test/TestTemplateItem/portal_components/test.erp5.testWorkflowAndDCWorkflow.py
View file @
40f1a34a
...
...
@@ -19,21 +19,8 @@ class TestERP5WorkflowMixin(testWorkflowMixin, object):
self
.
copyWorkflow
(
self
.
portal
.
portal_workflow
,
self
.
initial_dc_interaction_workflow_id
,
self
.
interaction_workflow_id
)
def
copyWorkflow
(
self
,
portal_workflow
,
old_wf_id
,
new_wf_id
):
"""
Create a copy of old_wf_id workflow
(overwrites existing object with new_wf_id ID if any)
"""
# Copy old_wf_id
copy
=
portal_workflow
.
manage_copyObjects
(
ids
=
[
old_wf_id
])
pasted
=
portal_workflow
.
manage_pasteObjects
(
copy
)
pasted_workflow_id
=
pasted
[
0
][
'new_id'
]
# Delete possibly existing object with new_wf_id ID
if
getattr
(
portal_workflow
,
new_wf_id
,
None
):
portal_workflow
.
manage_delObjects
(
new_wf_id
)
portal_workflow
.
manage_renameObjects
(
ids
=
[
pasted_workflow_id
,],
new_ids
=
[
new_wf_id
,])
self
.
tic
()
portal_workflow
.
copyWorkflow
(
old_wf_id
,
new_wf_id
)
self
.
commit
()
def
getTestObject
(
self
):
self
.
portal
=
self
.
getPortal
()
...
...
@@ -217,7 +204,6 @@ class TestConvertedWorkflow(TestERP5WorkflowMixin):
def
test_13_permission
(
self
):
"""
test permission/role mapping on states (ERP5 Workflow only)
# XXX(WORKFLOW) move this test to testERP5Workflow?
"""
portal_workflow
=
self
.
portal
.
portal_workflow
...
...
@@ -351,4 +337,4 @@ def test_suite():
suite
=
unittest
.
TestSuite
()
suite
.
addTest
(
unittest
.
makeSuite
(
TestDCWorkflow
))
suite
.
addTest
(
unittest
.
makeSuite
(
TestConvertedWorkflow
))
return
suite
\ No newline at end of file
return
suite
product/ERP5Workflow/Tool/WorkflowTool.py
View file @
40f1a34a
...
...
@@ -168,6 +168,24 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool):
return
True
return
False
def
copyWorkflow
(
self
,
old_workflow_id
,
new_workflow_id
):
"""
Create a copy of old_workflow_id workflow
(overwrites existing object with new_workflow_id ID if any)
"""
# Copy old_workflow_id
copy
=
self
.
manage_copyObjects
(
ids
=
[
old_workflow_id
])
pasted
=
self
.
manage_pasteObjects
(
copy
)
pasted_workflow_id
=
pasted
[
0
][
'new_id'
]
# Delete possibly existing object with new_workflow_id ID
if
getattr
(
self
,
new_workflow_id
,
None
):
self
.
manage_delObjects
(
new_workflow_id
)
self
.
manage_renameObjects
(
ids
=
[
pasted_workflow_id
,],
new_ids
=
[
new_workflow_id
,])
def
doActionFor
(
self
,
ob
,
action
,
wf_id
=
None
,
*
args
,
**
kw
):
workflow_list
=
self
.
getWorkflowsFor
(
ob
.
getPortalType
())
action_ref
=
action
...
...
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