Commit b83e3547 authored by Tomáš Peterka's avatar Tomáš Peterka Committed by Tomáš Peterka

[hal_json] Improve backward compatibility of value resolution by calling...

[hal_json] Improve backward compatibility of value resolution by calling Scripts on search result underlying object
parent 536d0a29
...@@ -273,9 +273,14 @@ def getAttrFromAnything(search_result, select, search_property_getter, kwargs): ...@@ -273,9 +273,14 @@ def getAttrFromAnything(search_result, select, search_property_getter, kwargs):
# Following part resolves values on other objects than Documents # Following part resolves values on other objects than Documents
# Prefer getter (accessor) than raw property name # Prefer getter (accessor) than raw property name
try:
underlying_search_result = search_result.getObject()
except:
underlying_search_result = search_result
if contents_value is None: if contents_value is None:
try: try:
contents_value = getattr(search_result, accessor_name) contents_value = getattr(underlying_search_result, accessor_name)
except (AttributeError, Unauthorized): except (AttributeError, Unauthorized):
pass pass
...@@ -818,7 +823,7 @@ def renderField(traversed_document, field, form, value=None, meta_type=None, key ...@@ -818,7 +823,7 @@ def renderField(traversed_document, field, form, value=None, meta_type=None, key
def renderForm(traversed_document, form, response_dict, key_prefix=None, selection_params=None): def renderForm(traversed_document, form, response_dict, key_prefix=None, selection_params=None):
""" """
:param selection_params: holds parameters to construct ERP5Form.Selection instance :param selection_params: holds parameters to construct ERP5Form.Selection instance
for underlaying ListBox - since we do not use selections in RenderJS UI for underlying ListBox - since we do not use selections in RenderJS UI
we mitigate the functionality here by overriding ListBox's own values we mitigate the functionality here by overriding ListBox's own values
for columns, editable columns, and sort with those found in `selection_params` for columns, editable columns, and sort with those found in `selection_params`
""" """
...@@ -915,7 +920,7 @@ def renderForm(traversed_document, form, response_dict, key_prefix=None, selecti ...@@ -915,7 +920,7 @@ def renderForm(traversed_document, form, response_dict, key_prefix=None, selecti
# ReportBox.render returns a list of ReportSection classes which are # ReportBox.render returns a list of ReportSection classes which are
# just containers for FormId(s) usually containing one ListBox # just containers for FormId(s) usually containing one ListBox
# and its search/query parameters hidden in `selection_params` # and its search/query parameters hidden in `selection_params`
# `path` contains relative_url of intended CONTEXT for underlaying ListBox # `path` contains relative_url of intended CONTEXT for underlying ListBox
report_item_list.extend(field.render()) report_item_list.extend(field.render())
# ERP5 Report document differs from a ERP5 Form in only one thing: it has # ERP5 Report document differs from a ERP5 Form in only one thing: it has
# `report_method` attached to it - thus we call it right here # `report_method` attached to it - thus we call it right here
......
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