Commit ffdc1a45 authored by Georgios Dagkakis's avatar Georgios Dagkakis

erp5_core: Fixups in Base_getRelatedDocumentList

- Remove passing of **kw to query, since it would break Listbox
pagination
- Avoid code duplication
- Fix indentation
parent 7e922a43
Pipeline #17049 failed with stage
...@@ -9,18 +9,16 @@ if portal_type is None: ...@@ -9,18 +9,16 @@ if portal_type is None:
portal_type = portal.getPortalDocumentTypeList() + portal.getPortalEmbeddedDocumentTypeList() portal_type = portal.getPortalDocumentTypeList() + portal.getPortalEmbeddedDocumentTypeList()
limit = kw.pop('limit', None) limit = kw.pop('limit', None)
follow_up_related_document_list = portal_catalog( follow_up_related_document_list = portal_catalog(
portal_type=portal_type, portal_type=portal_type,
follow_up_uid=context.getUid(), follow_up_uid=context.getUid(),
**kw
) )
document_query = Query(relative_url='%s/%%' % context.getRelativeUrl().replace('_', r'\_'))
if follow_up_related_document_list: if follow_up_related_document_list:
document_query = ComplexQuery( document_query = ComplexQuery(
Query(relative_url='%s/%%' % context.getRelativeUrl().replace('_', r'\_')), document_query,
Query(uid=[x.getUid() for x in follow_up_related_document_list]), Query(uid=[x.getUid() for x in follow_up_related_document_list]),
logical_operator='or' logical_operator='or'
) )
else:
document_query = Query(relative_url='%s/%%' % context.getRelativeUrl().replace('_', r'\_'))
if query is None: if query is None:
query = document_query query = document_query
else: else:
......
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