Commit fa673cc3 authored by Romain Courteaud's avatar Romain Courteaud

[erp5_web_renderjs_ui] Do not display empty relation field in non editable mode

parent b705495d
......@@ -12,8 +12,16 @@
if (field.type === "FormBox") {return true; }
// hidden fields should not be obviously rendered
if (field.hidden === 1) {return false; }
// empty default value is bad and final decision
return !isEmpty(field['default']);
// empty default value must not be displayed
if (isEmpty(field['default'])) {
return false;
}
// relation field with no value must not be displayed too
if ((field['default'].length === 1) && (isEmpty(field['default'][0]))) {
return false;
}
// display the field by default
return true;
}
rJS(window)
......
......@@ -230,7 +230,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>966.32979.9603.63197</string> </value>
<value> <string>967.24700.63112.6741</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>1522336529.93</float>
<float>1525686010.1</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -42,7 +42,19 @@
<td></td>
</tr>
<!-- Field with value are displayed in read only -->
<!-- Empty relation field are not displayed -->
<tr>
<td>assertElementNotPresent</td>
<td>//label[@for='field_my_foo_category_title']</td>
<td></td>
</tr>
<tr>
<td>assertElementNotPresent</td>
<td>//input[@name='field_my_foo_category_title']</td>
<td></td>
</tr>
<!-- string Field with value are displayed in read only -->
<tr>
<td>assertElementPresent</td>
<td>//label[@for='field_my_id' and text()='ID']</td>
......
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