From e1edd62320fef4991ba9554ee197021b45987a60 Mon Sep 17 00:00:00 2001 From: David Monjoie Date: Fri, 5 May 2017 16:34:54 +0200 Subject: [FIX] web: toggle checkboxes when clicked in editable list view Previously, the checkbox was not checked when it was clicked in editable list view, it only opened the row but did not check the checkbox. --- addons/web/static/src/js/fields/basic_fields.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'addons/web/static/src/js/fields/basic_fields.js') diff --git a/addons/web/static/src/js/fields/basic_fields.js b/addons/web/static/src/js/fields/basic_fields.js index 3e9ea89be31..6fc1736870f 100644 --- a/addons/web/static/src/js/fields/basic_fields.js +++ b/addons/web/static/src/js/fields/basic_fields.js @@ -581,6 +581,23 @@ var FieldBoolean = AbstractField.extend({ // Public //-------------------------------------------------------------------------- + /** + * Toggle the checkbox if it is activated due to a click on itself. + * + * @override + */ + activate: function (options) { + var activated = this._super.apply(this, arguments); + // The formatValue of boolean fields renders HTML elements similar to + // the one rendered by the widget itself. Even though the event might + // have been fired on the non-widget version of this field, we can still + // test the presence of its o_checkbox class. + if (activated && options && options.event && $(options.event.target).parents('.o_checkbox').length) { + this._setValue(!this.value); // Toggle the checkbox + } + return activated; + }, + /** * @override * @returns {jQuery} the focusable checkbox input -- cgit v1.2.3