diff options
| author | Julien Mougenot <jum@odoo.com> | 2019-09-09 11:05:46 +0000 |
|---|---|---|
| committer | Julien Mougenot <jum@odoo.com> | 2019-09-18 08:24:02 +0000 |
| commit | 01d7077bddbf12d430378fa85542f9c04fd11acc (patch) | |
| tree | 6e58da100ecc6b8dcd11118dd55da48618cc8cae /addons/web/static/src/js | |
| parent | 8c6de8c452804094da17ac9e77c6f2b7b047dc29 (diff) | |
[FIX] web: readonly many2one in list views
Fixes the way many2one fields are rendered in editable list views.
Before this commit, many2ones in readonly mode would render as links
and their widget would be considered as active even though you couldn't
edit it.
Now, they are rendered as plain text and act the same way as readonly char fields.
Diffstat (limited to 'addons/web/static/src/js')
| -rw-r--r-- | addons/web/static/src/js/fields/relational_fields.js | 19 |
1 files changed, 19 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 8155f9d56f1..5efaa2c8468 100644 --- a/addons/web/static/src/js/fields/relational_fields.js +++ b/addons/web/static/src/js/fields/relational_fields.js @@ -766,6 +766,25 @@ var FieldMany2One = AbstractField.extend({ }); var ListFieldMany2One = FieldMany2One.extend({ + events: _.extend({}, FieldMany2One.prototype.events, { + 'focusin input': '_onInputFocusin', + }), + + //-------------------------------------------------------------------------- + // 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 |
