Commit 5b5b5b33 authored by Ayush Tiwari's avatar Ayush Tiwari

erp5_catalog: Ignore case for title property and update...

erp5_catalog: Ignore case for title property and update default_erp5_catalog_id only when we create new erp5_catalog
parent ac4b76a7
...@@ -1719,6 +1719,9 @@ class ERP5Site(FolderMixIn, CMFSite, CacheCookieMixin): ...@@ -1719,6 +1719,9 @@ class ERP5Site(FolderMixIn, CMFSite, CacheCookieMixin):
catalog_tool.manage_addProduct['ERP5Catalog'].manage_addERP5Catalog( catalog_tool.manage_addProduct['ERP5Catalog'].manage_addERP5Catalog(
id = erp5_catalog_id, id = erp5_catalog_id,
title = '') title = '')
# Update default erp5 catalog id, the first time we run create ..
# ERP5Catalog object.
catalog_tool.default_erp5_catalog_id = erp5_catalog_id
erp5_catalog = catalog_tool._getOb(erp5_catalog_id) erp5_catalog = catalog_tool._getOb(erp5_catalog_id)
# No need to migrate if the erp5_catalog is not an object of ERP5Catlog # No need to migrate if the erp5_catalog is not an object of ERP5Catlog
...@@ -1745,13 +1748,12 @@ class ERP5Site(FolderMixIn, CMFSite, CacheCookieMixin): ...@@ -1745,13 +1748,12 @@ class ERP5Site(FolderMixIn, CMFSite, CacheCookieMixin):
# This is needed because there have been problems with setting property # This is needed because there have been problems with setting property
# for title, see this docstring for explanations: # for title, see this docstring for explanations:
# https://lab.nexedi.com/nexedi/erp5/blob/198df7021a17725e81ab930015c3c618e94263db/product/ERP5Type/Base.py#L3531 # https://lab.nexedi.com/nexedi/erp5/blob/198df7021a17725e81ab930015c3c618e94263db/product/ERP5Type/Base.py#L3531
if not property_id == 'title': if property_id == 'title':
value = getattr(sql_catalog, property_id) # Ignore case when property_id is title
erp5_catalog._updateProperty(id=property_id, value=value) #erp5_catalog.setTitle('erp5_catalog_new')
continue
# Update default erp5 catalog id, everytime we run migration value = getattr(sql_catalog, property_id)
# ERP5 Catalog(basically when this fucntion is called while creating ERP5Site) erp5_catalog._updateProperty(id=property_id, value=value)
catalog_tool.default_erp5_catalog_id = erp5_catalog_id
Globals.InitializeClass(ERP5Site) Globals.InitializeClass(ERP5Site)
......
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