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
Hugo Ricateau
erp5
Commits
85c1f807
Commit
85c1f807
authored
Jul 12, 2011
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
migrateToEmbeddedFile: migrate directly to portal type class + option to simulate
parent
b3e4561c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
18 deletions
+19
-18
bt5/erp5_base/ExtensionTemplateItem/BaseMigration.py
bt5/erp5_base/ExtensionTemplateItem/BaseMigration.py
+14
-14
bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/ERP5Site_migrateToEmbeddedFile.xml
...portal_skins/erp5_base/ERP5Site_migrateToEmbeddedFile.xml
+4
-3
bt5/erp5_base/bt/revision
bt5/erp5_base/bt/revision
+1
-1
No files found.
bt5/erp5_base/ExtensionTemplateItem/BaseMigration.py
View file @
85c1f807
...
...
@@ -26,19 +26,19 @@
#
##############################################################################
def
migrateToEmbeddedFile
(
self
):
""" Migrate all embedded "File" and "Image"
import
erp5
from
Products.ERP5.Extensions.CheckPortalTypes
import
changeObjectClass
def
migrateToEmbeddedFile
(
self
,
force
=
0
):
"""Migrate all embedded "File" and "Image"
objects to an unified "Embedded File
"""
from
Products.ERP5.Extensions.CheckPortalTypes
import
changeObjectClass
from
Products.ERP5.Document.EmbeddedFile
import
EmbeddedFile
if
self
.
getPortalType
()
in
(
'File'
,
'Image'
,)
and
\
self
.
getValidationState
()
==
'embedded'
:
changeObjectClass
(
self
.
getParentValue
(),
self
.
id
,
EmbeddedFile
)
instance
=
getattr
(
self
.
getParentValue
(),
self
.
id
)
instance
.
portal_type
=
EmbeddedFile
.
portal_type
instance
.
reindexObject
()
self
.
log
(
"Migrated %s"
%
self
.
getRelativeUrl
())
return
self
.
getRelativeUrl
()
\ No newline at end of file
portal_type
=
self
.
getPortalType
()
if
portal_type
in
(
'File'
,
'Image'
)
and
self
.
getValidationState
()
==
'embedded'
:
embedded_type
=
'Embedded File'
container
=
self
.
getParentValue
()
id
=
self
.
id
if
force
==
1
:
changeObjectClass
(
container
,
id
,
getattr
(
erp5
.
portal_type
,
embedded_type
))
container
.
_getOb
(
id
).
portal_type
=
embedded_type
return
'%s: %s -> %s'
%
(
self
.
getRelativeUrl
(),
portal_type
,
embedded_type
),
bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/ERP5Site_migrateToEmbeddedFile.xml
View file @
85c1f807
...
...
@@ -55,9 +55,10 @@
objects to an unified "Embedded File".\n
"""\n
active_process = context.getPortalObject().portal_activities.newActiveProcess()\n
context.ERP5Site_checkDataWithScript("Base_migrateToEmbeddedFile", \n
tag="migrate",\n
active_process=active_process.getPath())\n
context.ERP5Site_checkDataWithScript("Base_migrateToEmbeddedFile",\n
tag="migrate",\n
active_process=active_process.getPath(),\n
method_kw=dict(force=1))\n
\n
print "Migration started with process id: %s" %active_process.getPath()\n
return printed\n
...
...
bt5/erp5_base/bt/revision
View file @
85c1f807
985
\ No newline at end of file
986
\ No newline at end of file
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