From 3c55407f111dcf44fdc0258b2352d208bdc71a0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Debongnie?= Date: Mon, 30 Oct 2017 15:21:14 +0100 Subject: [FIX] web: allow dropdown selection in m2o Before this commit, many2one fields were not (fully) usable in a list view: if the user wrote some text, then when a dropdown with various choices opened, pressed the 'down' key (to select a choice), the down keypress caused a navigation move to the next line, which cancelled the selection. In this commit, we make the assumption that if the many2one dropdown is opened, then navigation moves are not what the user wants. --- addons/web/static/src/js/fields/relational_fields.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'addons/web/static/src/js/fields/relational_fields.js') diff --git a/addons/web/static/src/js/fields/relational_fields.js b/addons/web/static/src/js/fields/relational_fields.js index 749efb4ce82..d7b4368036d 100644 --- a/addons/web/static/src/js/fields/relational_fields.js +++ b/addons/web/static/src/js/fields/relational_fields.js @@ -533,14 +533,17 @@ var FieldMany2One = AbstractField.extend({ * start/end of the input element. Stops any navigation move event if the * user is selecting text. * - * TODO this is a duplicate of InputField._onNavigationMove, maybe this - * should be done in a mixin or, better, the m2o field should be an - * InputField (but this requires some refactoring). - * * @private * @param {OdooEvent} ev */ - _onNavigationMove: basicFields.InputField.prototype._onNavigationMove, + _onNavigationMove: function (ev) { + // TODO Maybe this should be done in a mixin or, better, the m2o field + // should be an InputField (but this requires some refactoring). + basicFields.InputField.prototype._onNavigationMove.apply(this, arguments); + if (this.mode === 'edit' && $(this.$input.autocomplete('widget')).is(':visible')) { + ev.stopPropagation(); + } + }, /** * @private * @param {OdooEvent} event -- cgit v1.2.3