summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/fields
diff options
context:
space:
mode:
authorGéry Debongnie <ged@odoo.com>2017-05-20 15:10:21 +0200
committerGéry Debongnie <ged@odoo.com>2017-05-22 10:07:31 +0200
commit28eadb3d6ee11bcee9bfe498387467c70953382a (patch)
tree0e6655e39f2911df5a2447a6282e139aa12e4738 /addons/web/static/src/js/fields
parent5e913677a5f5fe54fd4560b6caa986b9c7c61647 (diff)
[FIX] web: improve navigation in field many2one
Before this commit, when the user write some text in a many2one, then press ENTER, the key event will trigger a navigation move, which will validate the field, and move the focus to the next line. The same issue happens when pressing TAB. With this commit, we simply stop the propagation, and preventdefault the event that cause the selection.
Diffstat (limited to 'addons/web/static/src/js/fields')
-rw-r--r--addons/web/static/src/js/fields/relational_fields.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/addons/web/static/src/js/fields/relational_fields.js b/addons/web/static/src/js/fields/relational_fields.js
index d48fa64466c..e89fb563f21 100644
--- a/addons/web/static/src/js/fields/relational_fields.js
+++ b/addons/web/static/src/js/fields/relational_fields.js
@@ -88,6 +88,7 @@ var FieldMany2One = AbstractField.extend({
'click .o_external_button': '_onExternalButtonClick',
'click': '_onClick',
}),
+ AUTOCOMPLETE_DELAY: 200,
init: function () {
this._super.apply(this, arguments);
@@ -147,6 +148,11 @@ var FieldMany2One = AbstractField.extend({
});
},
select: function (event, ui) {
+ // we do not want the select event to trigger any additional
+ // effect, such as navigating to another field.
+ event.stopImmediatePropagation();
+ event.preventDefault();
+
var item = ui.item;
self.floating = false;
if (item.id) {
@@ -162,7 +168,7 @@ var FieldMany2One = AbstractField.extend({
autoFocus: true,
html: true,
minLength: 0,
- delay: 200,
+ delay: this.AUTOCOMPLETE_DELAY,
});
this.$input.autocomplete("option", "position", { my : "left top", at: "left bottom" });
this.autocomplete_bound = true;