From 9e6c616130622eabc5a43f84eca80c6326ded20b Mon Sep 17 00:00:00 2001 From: Martin Geubelle Date: Wed, 11 Apr 2018 17:19:45 +0200 Subject: [FIX] web: focus select in reference widget In the reference widget, the focus was always on the input (many2one) even though the first select (with the model) was not set. Thanks to @kaerdsar for the original PR. Partially closes #24070 --- addons/web/static/src/js/fields/relational_fields.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (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 bc44d6b659a..5c670e11c73 100644 --- a/addons/web/static/src/js/fields/relational_fields.js +++ b/addons/web/static/src/js/fields/relational_fields.js @@ -2280,6 +2280,21 @@ var FieldReference = FieldMany2One.extend({ return this._super.apply(this, arguments); }, + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + /** + * @override + * @returns {jQuery} + */ + getFocusableElement: function () { + if (this.mode === 'edit' && !this.field.relation) { + return this.$('select'); + } + return this._super.apply(this, arguments); + }, + //-------------------------------------------------------------------------- // Private //-------------------------------------------------------------------------- -- cgit v1.2.3