Commit 13e5d68a authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki Committed by Boxiang Sun

erp5_core: use preferred category child item list method in Predicate tab.

parent 0ab41cd1
...@@ -8,16 +8,17 @@ for item in multimembership_base_list : ...@@ -8,16 +8,17 @@ for item in multimembership_base_list :
category_list = [] category_list = []
display_method_id = context.getPortalObject().portal_preferences.getPreference('preferred_category_child_item_list_method_id', 'getCategoryChildCompactLogicalPathItemList')
ctool = context.portal_categories ctool = context.portal_categories
for item in mixed_list: for item in mixed_list:
base_category = ctool[item] base_category = ctool[item]
item_list = base_category.getCategoryChildCompactLogicalPathItemList(base=1)[:] item_list = getattr(base_category, display_method_id)(base=1)[:]
if item_list == [['', '']]: if item_list == [['', '']]:
for fallback_category_id in base_category.getFallbackBaseCategoryList(): for fallback_category_id in base_category.getFallbackBaseCategoryList():
fallback_category = ctool.restrictedTraverse(fallback_category_id, None) fallback_category = ctool.restrictedTraverse(fallback_category_id, None)
if fallback_category is not None and fallback_category.objectIds(): if fallback_category is not None and fallback_category.objectIds():
item_list.extend([('%s/%s' % (fallback_category_id, x[0]), '%s/%s' % (item, x[1])) \ item_list.extend([('%s/%s' % (fallback_category_id, x[0]), '%s/%s' % (item, x[1])) \
for x in fallback_category.getCategoryChildCompactLogicalPathItemList(base=1) if x[0]]) for x in getattr(fallback_category, display_method_id)(base=1) if x[0]])
break break
category_list.extend(item_list) category_list.extend(item_list)
......
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