Commit e4855960 authored by Ayush Tiwari's avatar Ayush Tiwari Committed by Ayush Tiwari

bt5_config: Move all attributes to sub-objects and donot reindex them

parent 407122cf
......@@ -278,7 +278,9 @@ class BusinessManager(Folder):
imported_manager = connection.importFile(file)
self.title = imported_manager.title
for obj in imported_manager.objectValues():
delattr(obj, '__ac_local_roles__')
self._setObject(obj.getId(), aq_base(obj))
obj.isIndexable = ConstantGetter('isIndexable', value=False)
self.setProperty('template_path_list', imported_manager.getProperty('template_path_list'))
def __add__(self, other):
......@@ -674,7 +676,8 @@ class BusinessItem(XMLObject):
# XXX: '_recursiveRemoveUid' is not working as expected
_recursiveRemoveUid(obj)
obj = aq_base(obj)
self._setObject(obj.getId(), obj)
obj.isIndexable = ConstantGetter('isIndexable', value=False)
self._setObject(obj.getId(), obj, suppress_events=True)
except AttributeError:
# In case the object doesn't exist, just pass without raising error
pass
......@@ -783,13 +786,18 @@ class BusinessItem(XMLObject):
# install object
obj = self.objectValues()[0]
obj = obj._getCopy(container)
container._setObject(object_id, obj)
obj = container._getOb(object_id)
# Before making `obj` a sub-object of `container`, we should the acquired
# roles on obj
obj.isIndexable = ConstantGetter('isIndexable', value=False)
delattr(obj, '__ac_local_roles__')
container._setObject(object_id, obj, suppress_events=True)
obj = container._getOb(object_id)
"""
aq_base(obj).uid = portal.portal_catalog.newUid()
del obj.isIndexable
if getattr(aq_base(obj), 'reindexObject', None) is not None:
obj.reindexObject()
"""
def unrestrictedResolveValue(self, context=None, path='', default=_MARKER,
restricted=0):
......
......@@ -46,6 +46,7 @@ from Products.ERP5Type.Tool.BaseTool import BaseTool
from Products.ERP5Type.Cache import transactional_cached
from Products.ERP5Type import Permissions
from Products.ERP5.Document.BusinessTemplate import BusinessTemplateMissingDependency
from Products.ERP5Type.Accessor.Constant import PropertyGetter as ConstantGetter
from Products.ERP5.genbt5list import generateInformation
from Acquisition import aq_base
from tempfile import mkstemp, mkdtemp
......@@ -1703,7 +1704,9 @@ class TemplateTool (BaseTool):
title='Old Installation State',
)
for item in combined_installed_path_item:
old_installation_state._setObject(item.getId(), aq_base(item))
item.isIndexable = ConstantGetter('isIndexable', value=False)
old_installation_state._setObject(item.getId(), aq_base(item),
suppress_events=True)
forbidden_bm_title_list = ['Old Installation State',]
for bm in bm_list:
......@@ -1725,7 +1728,9 @@ class TemplateTool (BaseTool):
)
for item in combined_new_path_item:
new_installation_state._setObject(item.getId(), aq_base(item))
item.isIndexable = ConstantGetter('isIndexable', value=False)
new_installation_state._setObject(item.getId(), aq_base(item),
suppress_events=True)
# Create installation process, which have the changes to be made in the
# OFS during installation. Importantly, it should also be a Business Manager
......@@ -1775,7 +1780,9 @@ class TemplateTool (BaseTool):
to_install_path_item_list.append(item)
for item in to_install_path_item_list:
installation_process._setObject(item.getId(), aq_base(item))
item.isIndexable = ConstantGetter('isIndexable', value=False)
installation_process._setObject(item.getId(), aq_base(item),
suppress_events=True)
error_list = self.compareOldStateToOFS(installation_process, old_installation_state)
......
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