Commit 9b0bd7a3 authored by Romain Courteaud's avatar Romain Courteaud

erp5_web: only search document portal_types

parent 51d70542
...@@ -21,6 +21,11 @@ ...@@ -21,6 +21,11 @@
from Products.ZSQLCatalog.SQLCatalog import SimpleQuery, ComplexQuery from Products.ZSQLCatalog.SQLCatalog import SimpleQuery, ComplexQuery
if portal is None: portal = context.getPortalObject() 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 # Find the applicable language
if language is None: if language is None:
language = portal.Localizer.get_selected_language() language = portal.Localizer.get_selected_language()
...@@ -49,6 +54,7 @@ base_sort = (('effective_date', 'descending'), ) ...@@ -49,6 +54,7 @@ base_sort = (('effective_date', 'descending'), )
document_list = context.searchResults( document_list = context.searchResults(
reference=name, reference=name,
effective_date=effective_date, effective_date=effective_date,
portal_type=valid_portal_type_list,
language=(language, ''), language=(language, ''),
sort_on=(('language', 'descending'), ) + base_sort, sort_on=(('language', 'descending'), ) + base_sort,
limit=1, limit=1,
......
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