diff options
| author | Christophe Simonis <chs@odoo.com> | 2019-05-06 12:27:51 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2019-05-06 12:27:51 +0200 |
| commit | a97037c6d442f186a798322a6eff586a3a118ef3 (patch) | |
| tree | 930cf70045eb8ec16323ccab3c4f6023aedb83bb /addons/web/static/src/js/fields/basic_fields.js | |
| parent | e5fc29564532e3c11a48b8c98a69675580d2c572 (diff) | |
| parent | 78b3b650b0ddcb5fb53fda505e9e61510a1364fc (diff) | |
[MERGE] forward port branch saas-12.2 up to 78b3b650b0d
Diffstat (limited to 'addons/web/static/src/js/fields/basic_fields.js')
| -rw-r--r-- | addons/web/static/src/js/fields/basic_fields.js | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/addons/web/static/src/js/fields/basic_fields.js b/addons/web/static/src/js/fields/basic_fields.js index 5919f100bcc..e546eb02be0 100644 --- a/addons/web/static/src/js/fields/basic_fields.js +++ b/addons/web/static/src/js/fields/basic_fields.js @@ -802,7 +802,7 @@ var FieldBoolean = AbstractField.extend({ * @returns {jQuery} the focusable checkbox input */ getFocusableElement: function () { - return this.$input || $(); + return this.mode === 'readonly' ? $() : this.$input; }, /** * A boolean field is always set since false is a valid value. @@ -1032,7 +1032,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. @@ -1059,7 +1065,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; @@ -1088,7 +1094,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 } }, |
