Commit dc77678e authored by Ayush Tiwari's avatar Ayush Tiwari

erp5_catalog: Use catalog object from ERP5Catalog class

Use default_sql_catalog_id as the object from ERP5Catalog class instead
of using catalog from Products.ZSQLCatalog.SQLCatalog.Catalog class.
This is required in the step by step migration of catalog inside ERP5.
parent bb9e9db0
......@@ -1313,14 +1313,20 @@ class ObjectTemplateItem(BaseTemplateItem):
container_container = portal.unrestrictedTraverse(container_path[:-1])
if container_container.meta_type == 'ERP5 Catalogs':
container_container.manage_addProduct['ZSQLCatalog'].manage_addSQLCatalog(id=container_path[-1], title='')
# Create a new container path list for the ERP5Catalog object
container_path_new = list(container_path)
container_path_new[-1] = container_path[-1]+'_new'
# Add ERP5Catalog object which will be further used as new Catalog
# instead of the SQLCatalog we used earlier
container_path_new = container_path[-1]+'_new'
container_container.manage_addProduct['ERP5Catalog'].manage_addERP5Catalog(id=erp5_catalog_id, title='')
if len(container_container.objectIds()) == 1:
container_container.default_sql_catalog_id = container_path[-1]
container_container.manage_addProduct['ERP5Catalog'].manage_addERP5Catalog(id=container_path_new[-1], title='')
# We will have more than 1 objects in portal_catalog as we are
# adding both ERP5Cataloga as well as SQLCatalog object here.
# Later on, this should be changed to use only ERP5Catalog object
if len(container_container.objectIds()) >= 1:
# Use ERP5Catalog object as the default sql catalog
container_container.default_sql_catalog_id = container_path_new[-1]
# Try installing ERP5Catalog instead of SQLCatalog
# Still in development phase, we are not completely remove the
# Still in development phase, we are not completely removing the
# dependency on SQLCatlaog
container = portal.unrestrictedTraverse(container_path_new)
else:
......
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