Commit 8bd18f5e authored by Nicolas Dumazet's avatar Nicolas Dumazet

fix migrateToPortalTypeClass so that migration is persistent.

Previously, the migration would work, but changes would not be recorded in the
ZODB.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@42239 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 105b81e1
......@@ -3878,6 +3878,10 @@ class Base( CopyContainer,
newklass = getattr(erp5.portal_type, portal_type)
assert klass != newklass
self.__class__ = newklass
self._p_changed = True
# this might look useless, but it is necessary to explicitely record
# the change in the parent container, because the class has changed
setattr(self.getParentValue(), self.getId(), self)
security.declareProtected(Permissions.DeletePortalContent,
'migratePortalType')
......
......@@ -96,7 +96,7 @@ class BaseTool (UniqueObject, Folder):
from Products.ERP5Type import document_class_registry
document_class_name = portal_type.replace(' ', '')
if document_class_name in document_class_registry:
type_definition.setTypeClass(document_class_name)
type_definition.type_class = document_class_name
else:
from Products.ERP5.Document.Document import NotConvertedError
raise NotConvertedError(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment