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