Commit ee37a095 authored by Xiaowu Zhang's avatar Xiaowu Zhang

erp5_web_renderjs_ui: add support for multirelationfield

parent 7ce7c30c
......@@ -189,8 +189,7 @@ def renderField(field, form_relative_url, meta_type=None, key=None):\n
for subkey in ("year", "month", "day", "hour", "minute", "ampm", "timezone"):\n
result["subfield_%s_key" % subkey] = traversed_document.Field_getSubFieldKeyDict(field, subkey, key=result["key"])\n
\n
\n
elif meta_type in ("RelationStringField"):\n
elif meta_type in ("RelationStringField", "MultiRelationStringField"):\n
portal_type_list = field.get_value(\'portal_type\')\n
if portal_type_list:\n
portal_type_list = [x[0] for x in portal_type_list]\n
......@@ -201,13 +200,13 @@ def renderField(field, form_relative_url, meta_type=None, key=None):\n
for k, v in field.get_value(\'parameter_list\'):\n
kw[k] = v\n
\n
accessor_name = \'get%sValue\' % \\\n
accessor_name = \'get%sValueList\' % \\\n
\'\'.join([part.capitalize() for part in base_category.split(\'_\')])\n
jump_reference = getattr(traversed_document, accessor_name)(\n
jump_reference_list = getattr(traversed_document, accessor_name)(\n
portal_type=[x[0] for x in field.get_value(\'portal_type\')],\n
\n
filter=kw\n
)\n
\n
query = url_template_dict["jio_search_template"] % {\n
"query": make_query({"query": sql_catalog.buildQuery(\n
{"portal_type": portal_type_list}\n
......@@ -239,8 +238,11 @@ def renderField(field, form_relative_url, meta_type=None, key=None):\n
"item", key=result["key"]\n
)\n
\n
if jump_reference:\n
result["relation_item_relative_url"] = jump_reference.getRelativeUrl()\n
if jump_reference_list:\n
url = [jump_reference.getRelativeUrl() for jump_reference in jump_reference_list]\n
uid = [jump_reference.getUid() for jump_reference in jump_reference_list]\n
result["relation_item_relative_url"] = url\n
result["relation_item_uid"] = uid\n
\n
elif meta_type == "CheckBoxField":\n
result = {\n
......
......@@ -125,6 +125,8 @@
field_url = \'gadget_erp5_field_string.html\';\n
} else if (type === \'RelationStringField\') {\n
field_url = \'gadget_erp5_field_relationstring.html\';\n
} else if (type === \'MultiRelationStringField\') {\n
field_url = \'gadget_erp5_field_multirelationfield.html\';\n
} else if (type === \'TextAreaField\') {\n
field_url = \'gadget_erp5_field_textarea.html\';\n
} else if (type === \'DateTimeField\') {\n
......@@ -251,6 +253,7 @@
if (group[0] !== "bottom") {\n
field_element.appendChild(label_element);\n
}\n
\n
field_url = getFieldTypeGadgetUrl(renderered_field.type);\n
\n
......@@ -585,7 +588,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>942.57027.49275.7236</string> </value>
<value> <string>943.1808.36899.34116</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -603,7 +606,7 @@
</tuple>
<state>
<tuple>
<float>1431049784.59</float>
<float>1432174400.48</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -266,7 +266,7 @@ promiseEventListener */\n
function setRelationJump(my_gadget, my_initial_call, my_selected_value) {\n
var props = my_gadget.property_dict,\n
field_json = props.field_json,\n
target_url = my_selected_value || field_json.relation_item_relative_url,\n
target_url = my_selected_value || field_json.relation_item_relative_url[0],\n
is_init = my_initial_call === true;\n
\n
if (target_url && field_json.allow_jump) {\n
......@@ -767,7 +767,7 @@ promiseEventListener */\n
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>942.57468.41646.29286</string> </value>
<value> <string>943.11588.15892.23876</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -785,7 +785,7 @@ promiseEventListener */\n
</tuple>
<state>
<tuple>
<float>1431075656.16</float>
<float>1432255062.93</float>
<string>UTC</string>
</tuple>
</state>
......
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