Commit 24016638 authored by Sven Franck's avatar Sven Franck

erp5_hal_json_style: fix bug when empty portal type list is returned

parent 68cb63e6
......@@ -133,14 +133,20 @@ def renderField(field, meta_type=None):\n
"required": field.get_value("required"),\n
}\n
elif meta_type in ("RelationStringField", "MultiRelationStringField"):\n
\n
portal_type_list = field.get_value(\'portal_type\');\n
if len(portal_type_list) > 0:\n
portal_types = portal_type_list[0]\n
else:\n
portal_types = []\n
\n
query = url_template_dict["jio_search_template"] % {\n
"query": make_query({"query": sql_catalog.buildQuery(\n
{"portal_type": [x[0] for x in field.get_value(\'portal_type\')]}\n
{"portal_type": [x[0] for x in portal_types]}\n
).asSearchTextExpression(sql_catalog)})\n
}\n
result = {\n
"portal_types": field.get_value(\'portal_type\')[0],\n
#"query": url_template_dict["jio_search_template"],\n
"portal_types": portal_types,\n
"query": query,\n
"catalog_index": field.get_value(\'catalog_index\'),\n
"allow_jump": field.get_value(\'allow_jump\'),\n
......
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