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
Ekaterina
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 @@
...
@@ -26,19 +26,19 @@
#
#
##############################################################################
##############################################################################
def
migrateToEmbeddedFile
(
self
):
import
erp5
""" Migrate all embedded "File" and "Image"
from
Products.ERP5.Extensions.CheckPortalTypes
import
changeObjectClass
def
migrateToEmbeddedFile
(
self
,
force
=
0
):
"""Migrate all embedded "File" and "Image"
objects to an unified "Embedded File
objects to an unified "Embedded File
"""
"""
from
Products.ERP5.Extensions.CheckPortalTypes
import
changeObjectClass
portal_type
=
self
.
getPortalType
()
from
Products.ERP5.Document.EmbeddedFile
import
EmbeddedFile
if
portal_type
in
(
'File'
,
'Image'
)
and
self
.
getValidationState
()
==
'embedded'
:
embedded_type
=
'Embedded File'
if
self
.
getPortalType
()
in
(
'File'
,
'Image'
,)
and
\
container
=
self
.
getParentValue
()
self
.
getValidationState
()
==
'embedded'
:
id
=
self
.
id
changeObjectClass
(
self
.
getParentValue
(),
self
.
id
,
EmbeddedFile
)
if
force
==
1
:
instance
=
getattr
(
self
.
getParentValue
(),
self
.
id
)
changeObjectClass
(
container
,
id
,
getattr
(
erp5
.
portal_type
,
embedded_type
))
instance
.
portal_type
=
EmbeddedFile
.
portal_type
container
.
_getOb
(
id
).
portal_type
=
embedded_type
instance
.
reindexObject
()
return
'%s: %s -> %s'
%
(
self
.
getRelativeUrl
(),
portal_type
,
embedded_type
),
self
.
log
(
"Migrated %s"
%
self
.
getRelativeUrl
())
return
self
.
getRelativeUrl
()
\ No newline at end of file
bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/ERP5Site_migrateToEmbeddedFile.xml
View file @
85c1f807
...
@@ -55,9 +55,10 @@
...
@@ -55,9 +55,10 @@
objects to an unified "Embedded File".\n
objects to an unified "Embedded File".\n
"""\n
"""\n
active_process = context.getPortalObject().portal_activities.newActiveProcess()\n
active_process = context.getPortalObject().portal_activities.newActiveProcess()\n
context.ERP5Site_checkDataWithScript("Base_migrateToEmbeddedFile", \n
context.ERP5Site_checkDataWithScript("Base_migrateToEmbeddedFile",\n
tag="migrate",\n
tag="migrate",\n
active_process=active_process.getPath())\n
active_process=active_process.getPath(),\n
method_kw=dict(force=1))\n
\n
\n
print "Migration started with process id: %s" %active_process.getPath()\n
print "Migration started with process id: %s" %active_process.getPath()\n
return printed\n
return printed\n
...
...
bt5/erp5_base/bt/revision
View file @
85c1f807
985
986
\ No newline at end of file
\ 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