From ec599466ac2bfe5d7c73372590afa69126be0b1a Mon Sep 17 00:00:00 2001 From: Romain Courteaud <romain@nexedi.com> Date: Tue, 4 Feb 2020 10:48:27 +0000 Subject: [PATCH] erp5_web: only search document portal_types --- .../erp5_web/StaticWebSection_getDocumentValue.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/StaticWebSection_getDocumentValue.py b/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/StaticWebSection_getDocumentValue.py index fd90cf5ef9..3eddcbb527 100644 --- a/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/StaticWebSection_getDocumentValue.py +++ b/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/StaticWebSection_getDocumentValue.py @@ -21,6 +21,11 @@ from Products.ZSQLCatalog.SQLCatalog import SimpleQuery, ComplexQuery if portal is None: portal = context.getPortalObject() +# The list of portal types here should be large enough to include +# all portal_types defined in the various sections so that +# href tags which point to a document by reference can still work. +valid_portal_type_list = portal.getPortalDocumentTypeList() + # Find the applicable language if language is None: language = portal.Localizer.get_selected_language() @@ -49,6 +54,7 @@ base_sort = (('effective_date', 'descending'), ) document_list = context.searchResults( reference=name, effective_date=effective_date, + portal_type=valid_portal_type_list, language=(language, ''), sort_on=(('language', 'descending'), ) + base_sort, limit=1, -- 2.30.9