From 6a50a125f07a7bec1e45c0b71e8e7438d02b4afa Mon Sep 17 00:00:00 2001 From: Julien Mougenot Date: Mon, 9 Sep 2019 11:05:46 +0000 Subject: [FIX] web: readonly many2one in list views Let's assume an editable list with a many2one and a char, the many2one being readonly. Before this rev., if the user clicked on the many2one, the row was switched in edit more, and the many2one link was given the focus. Now, in the same scenario, the focus is given to the char field which can be edited (i.e. its input). Task 2068280 --- addons/web/static/src/js/fields/relational_fields.js | 16 ++++++++++++++++ 1 file changed, 16 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 b2d3379aef1..f713342c240 100644 --- a/addons/web/static/src/js/fields/relational_fields.js +++ b/addons/web/static/src/js/fields/relational_fields.js @@ -821,6 +821,22 @@ var Many2oneBarcode = FieldMany2One.extend({ var ListFieldMany2One = FieldMany2One.extend({ + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + /** + * If in readonly, will never be considered as an active widget. + * + * @override + */ + activate: function () { + if (this.mode === 'readonly') { + return false; + } + return this._super.apply(this, arguments); + }, + //-------------------------------------------------------------------------- // Private //-------------------------------------------------------------------------- -- cgit v1.2.3