Commit 8c987515 authored by Roque's avatar Roque

erp5_hal_json_style: patch for gadget field properties

parent f6f91be3
...@@ -409,13 +409,17 @@ def getFieldRawProperties(field, meta_type=None, key=None, key_prefix=None): ...@@ -409,13 +409,17 @@ def getFieldRawProperties(field, meta_type=None, key=None, key_prefix=None):
"overrides": field.overrides, "overrides": field.overrides,
"message_values": field.message_values "message_values": field.message_values
} }
# these patchs change the field property names as are required by js rendering
form_list_patch = False form_list_patch = False
gadget_field_patch = False
for key in field.values.keys(): for key in field.values.keys():
# sometimes, field.values returns a key as string and also as a tuple # sometimes, field.values returns a key as string and also as a tuple
if type(key) is str: if type(key) is str:
result["values"][key] = field.values[key] result["values"][key] = field.values[key]
if key == "columns": if key == "columns":
form_list_patch = True form_list_patch = True
if key == "gadget_url":
gadget_field_patch = True
if form_list_patch: if form_list_patch:
try: try:
result["values"]["column_list"] = result["values"]["columns"] result["values"]["column_list"] = result["values"]["columns"]
...@@ -427,8 +431,14 @@ def getFieldRawProperties(field, meta_type=None, key=None, key_prefix=None): ...@@ -427,8 +431,14 @@ def getFieldRawProperties(field, meta_type=None, key=None, key_prefix=None):
query = "portal_type%3A%22" + portal_type + "%22" if portal_type else "" query = "portal_type%3A%22" + portal_type + "%22" if portal_type else ""
full_query = "urn:jio:allDocs?query=" + query full_query = "urn:jio:allDocs?query=" + query
result["values"]["query"] = full_query result["values"]["query"] = full_query
except: except KeyError:
log("error while patching form list definition") log("error while patching form list definition")
if gadget_field_patch:
try:
result["values"]["url"] = result["values"]["gadget_url"]
result["values"]["renderjs_extra"] = result["values"]["renderjs_extra"][0][0]
except KeyError:
log("error while patching form gadget list definition")
for key in field.tales.keys(): for key in field.tales.keys():
if field.tales[key]: if field.tales[key]:
result["tales"][key] = str(field.tales[key]) result["tales"][key] = str(field.tales[key])
......
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