diff options
| author | Martin Geubelle <mge@odoo.com> | 2018-04-11 17:19:45 +0200 |
|---|---|---|
| committer | Martin Geubelle <mge@odoo.com> | 2018-04-17 15:31:32 +0200 |
| commit | 9e6c616130622eabc5a43f84eca80c6326ded20b (patch) | |
| tree | 33dfda4c15e5603059dfb775c5efb03f449eb812 /addons/web/static/src/js | |
| parent | df02dc37fd2febd3fc899792ee25c80c0149d255 (diff) | |
[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
Diffstat (limited to 'addons/web/static/src/js')
| -rw-r--r-- | addons/web/static/src/js/fields/relational_fields.js | 15 |
1 files changed, 15 insertions, 0 deletions
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 @@ -2281,6 +2281,21 @@ var FieldReference = FieldMany2One.extend({ }, //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + /** + * @override + * @returns {jQuery} + */ + getFocusableElement: function () { + if (this.mode === 'edit' && !this.field.relation) { + return this.$('select'); + } + return this._super.apply(this, arguments); + }, + + //-------------------------------------------------------------------------- // Private //-------------------------------------------------------------------------- |
