summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/fields/basic_fields.js
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2019-04-12 16:28:18 +0200
committerChristophe Simonis <chs@odoo.com>2019-04-12 16:28:18 +0200
commitefa90f78e552a980abb54fe70160aac441a0a788 (patch)
tree1806246dbb1663530abe092a038ac69fe2c9070b /addons/web/static/src/js/fields/basic_fields.js
parent4df020135ccc1b30173c8acabc8d3a1ba2dfadf9 (diff)
parent385342b575f6f8510cea6c90108be7b510fd1fa1 (diff)
[MERGE] forward port branch 12.0 up to 385342b575f
Diffstat (limited to 'addons/web/static/src/js/fields/basic_fields.js')
-rw-r--r--addons/web/static/src/js/fields/basic_fields.js13
1 files changed, 10 insertions, 3 deletions
diff --git a/addons/web/static/src/js/fields/basic_fields.js b/addons/web/static/src/js/fields/basic_fields.js
index ee911b141a0..8faa6e97ea8 100644
--- a/addons/web/static/src/js/fields/basic_fields.js
+++ b/addons/web/static/src/js/fields/basic_fields.js
@@ -1035,7 +1035,13 @@ var FieldFloatToggle = AbstractField.extend({
* @returns {float} The current formatted value
*/
_getDisplayedValue: function () {
- return parseFloat(this._formatValue(this.value));
+ // this.value is a plain float
+ // Matches what is in Database
+ var usrFormatValue = this._formatValue(this.value);
+ // usrFormatValue is string
+ // contains a float represented in a user specific format
+ // the float is the fraction by [this.factor] of this.value
+ return field_utils.parse['float'](usrFormatValue);
},
/**
* Formats the HTML input tag for edit mode and stores selection status.
@@ -1062,7 +1068,7 @@ var FieldFloatToggle = AbstractField.extend({
* one is not in the range, the next value of the closest one will be chosen.
*
* @private
- * @returns {number} The next formatted value in the range
+ * @returns {number} The next value in the range
*/
_nextValue: function () {
var range = this.nodeOptions.range;
@@ -1091,7 +1097,8 @@ var FieldFloatToggle = AbstractField.extend({
if (this.mode === 'edit') {
ev.stopPropagation(); // only stop propagation in edit mode
var next_val = this._nextValue();
- this._setValue(next_val.toString()); // will be parsed in _setValue
+ next_val = field_utils.format['float'](next_val);
+ this._setValue(next_val); // will be parsed in _setValue
}
},