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
Hamza
erp5
Commits
7c19e3f3
Commit
7c19e3f3
authored
May 29, 2015
by
wenjie.zheng
Committed by
Sebastien Robin
Jul 16, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ERP5Site.py: delicate way to migrate workflow tool without triggering security check.
parent
35962619
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
8 deletions
+28
-8
product/ERP5/ERP5Site.py
product/ERP5/ERP5Site.py
+28
-8
No files found.
product/ERP5/ERP5Site.py
View file @
7c19e3f3
...
...
@@ -45,6 +45,10 @@ import os
import
warnings
import
transaction
from
App.config
import
getConfiguration
from
Products.ERP5.Tool.ERP5WorkflowTool
import
ERP5WorkflowTool
from
zope.lifecycleevent
import
ObjectCopiedEvent
from
OFS.event
import
ObjectClonedEvent
from
zope.event
import
notify
MARKER
=
[]
# Site Creation DTML
...
...
@@ -1644,15 +1648,31 @@ class ERP5Site(FolderMixIn, CMFSite, CacheCookieMixin):
"""
tool
=
self
.
portal_workflow
if
tool
.
getPortalType
()
!=
'ERP5 Workflow Tool'
:
object_id_list
=
tool
.
objectIds
()
object_clipboard
=
tool
.
manage_copyObjects
(
object_id_list
)
new_tool
=
self
.
newContent
(
id
=
'portal_workflow_new'
,
portal_type
=
'ERP5 Workflow Tool'
)
new_tool
.
manage_pasteObjects
(
object_clipboard
)
# create new ERP5 Workflow Tool
self
.
_setObject
(
'portal_workflow_new'
,
ERP5WorkflowTool
()
)
new_tool
=
getattr
(
self
,
'portal_workflow_new'
)
new_tool
.
_chains_by_type
=
tool
.
_chains_by_type
# backup old type workflow tool
self
.
manage_delObjects
(
'portal_workflow'
)
self
.
manage_renameObject
(
new_tool
.
id
,
'portal_workflow'
)
new_tool
.
id
=
'portal_workflow'
# copy-paste operation
for
id
in
tool
.
objectIds
():
ob
=
tool
.
_getOb
(
id
)
orig_id
=
ob
.
getId
()
ob
.
_notifyOfCopyTo
(
new_tool
,
op
=
0
)
orig_ob
=
ob
ob
=
ob
.
_getCopy
(
new_tool
)
ob
.
_setId
(
id
)
notify
(
ObjectCopiedEvent
(
ob
,
orig_ob
))
new_tool
.
_setObject
(
id
,
ob
)
ob
=
new_tool
.
_getOb
(
id
)
ob
.
wl_clearLocks
()
ob
.
_postCopy
(
new_tool
,
op
=
0
)
notify
(
ObjectClonedEvent
(
ob
))
# migration
self
.
portal_workflow
=
new_tool
self
.
portal_workflow
.
id
=
'portal_workflow'
self
.
_delObject
(
new_tool
)
Globals
.
InitializeClass
(
ERP5Site
)
def
getBootstrapDirectory
():
...
...
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