Commit 651ab9a2 authored by Xiaowu Zhang's avatar Xiaowu Zhang

erp5_web: fix data inconsistency after change preference

parent 24934b05
...@@ -5,8 +5,9 @@ Use Auditor proxy role to let anonymous users accessing resources. ...@@ -5,8 +5,9 @@ Use Auditor proxy role to let anonymous users accessing resources.
from Products.ERP5Type.Cache import CachingMethod from Products.ERP5Type.Cache import CachingMethod
portal = context.getPortalObject() portal = context.getPortalObject()
use_uid = portal.portal_categories.getCategoryUid(portal.portal_preferences.getPreferredEventUse(), base_category='use')
sql_kw = {'portal_type': portal.getPortalResourceTypeList(), sql_kw = {'portal_type': portal.getPortalResourceTypeList(),
'use_uid': portal.portal_categories.getCategoryUid(portal.portal_preferences.getPreferredEventUse(), base_category='use'), 'use_uid': use_uid,
'validation_state': 'validated', 'validation_state': 'validated',
'sort_on': 'title'} 'sort_on': 'title'}
...@@ -14,7 +15,7 @@ def getResourceItemList(): ...@@ -14,7 +15,7 @@ def getResourceItemList():
return [('', '')] + [(result.getTitle(), result.getRelativeUrl()) for result in portal.portal_catalog(**sql_kw)] return [('', '')] + [(result.getTitle(), result.getRelativeUrl()) for result in portal.portal_catalog(**sql_kw)]
getResourceItemList = CachingMethod(getResourceItemList, getResourceItemList = CachingMethod(getResourceItemList,
id=(script.id, context.Localizer.get_selected_language()), id=(script.id, context.Localizer.get_selected_language(), use_uid),
cache_factory='erp5_ui_long') cache_factory='erp5_ui_long')
return getResourceItemList() return getResourceItemList()
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