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

BusinessTemplate: Do not add/use filter_dict attribute to ERP5Catalog instance

parent 6dc8640b
......@@ -3048,8 +3048,7 @@ class CatalogMethodTemplateItem(ObjectTemplateItem):
new_value.sort()
setattr(catalog, key, tuple(new_value))
if catalog.meta_type == 'ERP5 Catalog':
catalog.filter_dict = catalog._getFilterDict()
filter_dict = catalog._getFilterDict()
# Restore filter
if self._is_filtered_archive.get(method_id, 0):
......@@ -3059,17 +3058,15 @@ class CatalogMethodTemplateItem(ObjectTemplateItem):
expr_instance = Expression(expression)
else:
expr_instance = None
if catalog.meta_type == 'SQLCatalog':
catalog.filter_dict[method_id] = PersistentMapping()
catalog.filter_dict[method_id]['filtered'] = 1
catalog.filter_dict[method_id]['expression'] = expression
catalog.filter_dict[method_id]['expression_instance'] = expr_instance
catalog.filter_dict[method_id]['expression_cache_key'] = \
filter_dict[method_id]['filtered'] = 1
filter_dict[method_id]['expression'] = expression
filter_dict[method_id]['expression_instance'] = expr_instance
filter_dict[method_id]['expression_cache_key'] = \
self._filter_expression_cache_key_archive.get(method_id, ())
catalog.filter_dict[method_id]['type'] = \
filter_dict[method_id]['type'] = \
self._filter_type_archive.get(method_id, ())
elif method_id in catalog.filter_dict.keys():
catalog.filter_dict[method_id]['filtered'] = 0
elif method_id in filter_dict.keys():
filter_dict[method_id]['filtered'] = 0
# backward compatibility
if hasattr(self, '_is_catalog_list_method_archive'):
......@@ -3146,8 +3143,9 @@ class CatalogMethodTemplateItem(ObjectTemplateItem):
# with both SQL Catalog and ERP5 Catalog.
setattr(catalog, catalog_prop_id, tuple(new_value))
if method_id in catalog.filter_dict.keys():
del catalog.filter_dict[method_id]
filter_dict = catalog._getFilterDict()
if method_id in filter_dict.keys():
del filter_dict[method_id]
# uninstall objects
ObjectTemplateItem.uninstall(self, context, **kw)
......
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