[FIX] web: digits precision

- Remove unnecessary "round_decimals". Will be process by format_value
- Fix json format value for digits attribute
This commit is contained in:
Adrien Dieudonne
2017-04-11 19:44:38 +02:00
committed by Aaron Bohy
parent dbc6f21321
commit eed432519e
2 changed files with 3 additions and 8 deletions
+1 -1
View File
@@ -217,7 +217,7 @@
<group name="weight" string="Weights">
<label for="volume"/>
<div class="o_row">
<field digits="(14, 3)" name="volume"/>
<field digits="[14, 3]" name="volume"/>
<span>m³</span>
</div>
<label for="weight"/>
@@ -562,8 +562,6 @@ var FieldFloat = InputField.extend({
this._super.apply(this, arguments);
if (this.attrs.digits) {
this.nodeOptions.digits = JSON.parse(this.attrs.digits);
} else {
this.nodeOptions.digits = this.field.digits;
}
},
@@ -591,11 +589,8 @@ var FieldFloat = InputField.extend({
* @private
*/
_renderReadonly: function () {
var value = this.value;
if (this.nodeOptions.digits && this.nodeOptions.digits.length === 2) {
value = utils.round_decimals(value, this.nodeOptions.digits[1]);
}
var $span = $('<span>').addClass('o_form_field o_form_field_number').text(this._formatValue(value));
var value = this._formatValue(this.value);
var $span = $('<span>').addClass('o_form_field o_form_field_number').text(value);
this.$el.html($span);
},
});