diff options
| author | Aaron Bohy <aab@odoo.com> | 2018-03-12 11:24:41 +0100 |
|---|---|---|
| committer | Aaron Bohy <aab@odoo.com> | 2018-03-12 12:56:00 +0100 |
| commit | a0b06afcf3852c2f97eacbddada253c928f37428 (patch) | |
| tree | f2518bb696c30a4482f065774e042609e6e70a3e /addons/web/static/src/js/fields/basic_fields.js | |
| parent | 8a1603eedaa8366ba6fb6c97bb58368ed854f2db (diff) | |
[FIX] web: 'toggle_button' widget in edit mode
The 'toggle_button' widget is one of special field widgets that
can trigger changes in readonly mode (in this case, toggle the
boolean value when clicked). It was working fine in form views in
'readonly' mode, as in this case, the new value is saved directly,
and the form view is re-rendered (a new widget is created with the
new value).
However, in 'edit' mode, the value isn't saved directly (the user
has to click on 'Save' to save the changes), the widget is reset
with its new value, and the reset wasn't correctly handled in this
particular widget.
Fixes #23400
Diffstat (limited to 'addons/web/static/src/js/fields/basic_fields.js')
| -rw-r--r-- | addons/web/static/src/js/fields/basic_fields.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/addons/web/static/src/js/fields/basic_fields.js b/addons/web/static/src/js/fields/basic_fields.js index 26e7d86fabc..8a42f91161c 100644 --- a/addons/web/static/src/js/fields/basic_fields.js +++ b/addons/web/static/src/js/fields/basic_fields.js @@ -1993,8 +1993,9 @@ var FieldToggleBoolean = AbstractField.extend({ * @private */ _render: function () { - var className = this.value ? 'o_toggle_button_success' : 'text-muted'; - this.$('i').addClass('fa fa-circle ' + className); + this.$('i') + .toggleClass('o_toggle_button_success', !!this.value) + .toggleClass('text-muted', !this.value); var title = this.value ? this.attrs.options.active : this.attrs.options.inactive; this.$el.attr('title', title); }, |
