Commit 4477ebf1 authored by Romain Courteaud's avatar Romain Courteaud

[erp5_web_renderjs_ui] Force float value to be displayed with the requested precision

parent 20793c52
......@@ -12,8 +12,8 @@
.declareMethod('render', function (options) {
var field_json = options.field_json || {},
value = field_json.value || field_json.default || "",
state_dict = {
value: field_json.value || field_json.default || "",
editable: field_json.editable,
required: field_json.required,
name: field_json.key,
......@@ -21,12 +21,14 @@
precision: field_json.precision,
hidden: field_json.hidden
};
state_dict.text_content = state_dict.value;
if (field_json.precision) {
state_dict.step = 1 / Math.pow(10, field_json.precision);
value = parseFloat(value || "0").toFixed(field_json.precision);
} else {
state_dict.step = 0.00000001;
}
state_dict.value = value;
state_dict.text_content = value;
return this.changeState(state_dict);
})
......
......@@ -230,7 +230,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>956.15709.17217.39492</string> </value>
<value> <string>956.15742.1027.50705</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>1482842913.66</float>
<float>1482844714.9</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -42,7 +42,7 @@
</tr>
<tr>
<td>assertElementPresent</td>
<td>//input[@value='' and @name='field_my_quantity']</td>
<td>//input[@value='0.0' and @name='field_my_quantity']</td>
<td></td>
</tr>
<tr>
......
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