From c60743428d9c47af1f18a331ebeadaebb23e3d4c Mon Sep 17 00:00:00 2001 From: qsm-odoo Date: Thu, 30 Mar 2017 11:51:45 +0200 Subject: [FIX] web: typo in function name (FieldBoolean._onKeydown) When focusing a checkbox field and hitting the "enter" key, the checkbox should change its status. Before this commit, this produced a traceback instead as it was trying to call the `_onKeyDown` function while it was defined as `_onKeydown`. Also the `_onKeydown` method is in fact declared in the `AbstractField` parent implementation, so there is no point in declaring the event binding twice. Also, part of the `FieldBoolean._onKeydown` code was in common with its parent `AbstractField._onKeydown` code so remove it as there is no point in duplicating it. Note: this `_onKeydown` method has to be refactored as it is breaking form view navigation anyway. Also modify an existing test to check the checkbox keyboard navigation. --- addons/web/static/src/js/fields/basic_fields.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (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 3a2aa23e0e0..245643ece57 100644 --- a/addons/web/static/src/js/fields/basic_fields.js +++ b/addons/web/static/src/js/fields/basic_fields.js @@ -373,7 +373,6 @@ var FieldBoolean = AbstractField.extend({ className: 'o_field_boolean', events: _.extend({}, AbstractField.prototype.events, { change: '_onChange', - keydown: '_onKeyDown', }), replace_element: true, supportedFieldTypes: ['boolean'], @@ -455,6 +454,7 @@ var FieldBoolean = AbstractField.extend({ * @param {KeyEvent} event */ _onKeydown: function (event) { + this._super.apply(this, arguments); switch (event.which) { case $.ui.keyCode.DOWN: this.trigger_up('move_down'); @@ -468,10 +468,6 @@ var FieldBoolean = AbstractField.extend({ case $.ui.keyCode.RIGHT: this.trigger_up('move_right'); break; - case $.ui.keyCode.TAB: - this.trigger_up('move_next'); - event.preventDefault(); - break; case $.ui.keyCode.ENTER: this.$input.prop('checked', !this.value); this._setValue(!this.value); -- cgit v1.2.3