diff --git a/web_m2x_options/README.rst b/web_m2x_options/README.rst index e007cb98a814..a1433c5ffc15 100644 --- a/web_m2x_options/README.rst +++ b/web_m2x_options/README.rst @@ -7,7 +7,7 @@ web_m2x_options !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:1f28c92cd5c1a43185c582e5aa670e47dc78efced048df3c27bf0e77a0b1ad0d + !! source digest: sha256:175ee076d100de2101690e681f8a5bbf768c8cb478a054af3d31f78b1ed4a4a5 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png @@ -92,6 +92,10 @@ in the field's options dict Deactivates the color picker on many2many_tags buttons to do nothing (ignored if open is set) +``ignore_m2x_options`` *boolean* (Default: ``False``) + + The field will be processed without following the implementation of this module. + ir.config_parameter options ~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -189,6 +193,7 @@ Contributors * Carlos Roca * Bhavesh Odedra * Dhara Solanki (http://www.initos.com) +* Alexandre D. Díaz Maintainers ~~~~~~~~~~~ diff --git a/web_m2x_options/readme/CONTRIBUTORS.rst b/web_m2x_options/readme/CONTRIBUTORS.rst index c42c7afe7a01..5fecf2886c22 100644 --- a/web_m2x_options/readme/CONTRIBUTORS.rst +++ b/web_m2x_options/readme/CONTRIBUTORS.rst @@ -12,3 +12,4 @@ * Carlos Roca * Bhavesh Odedra * Dhara Solanki (http://www.initos.com) +* Alexandre D. Díaz diff --git a/web_m2x_options/readme/USAGE.rst b/web_m2x_options/readme/USAGE.rst index b6bb6aa2e60b..43c0f3926020 100644 --- a/web_m2x_options/readme/USAGE.rst +++ b/web_m2x_options/readme/USAGE.rst @@ -43,6 +43,10 @@ in the field's options dict Deactivates the color picker on many2many_tags buttons to do nothing (ignored if open is set) +``ignore_m2x_options`` *boolean* (Default: ``False``) + + The field will be processed without following the implementation of this module. + ir.config_parameter options ~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/web_m2x_options/static/src/js/form.js b/web_m2x_options/static/src/js/form.js index 9d18cf52efc6..b27856dfc682 100644 --- a/web_m2x_options/static/src/js/form.js +++ b/web_m2x_options/static/src/js/form.js @@ -98,6 +98,10 @@ odoo.define("web_m2x_options.web_m2x_options", function (require) { FieldMany2One.include({ _onInputFocusout: function () { + if (this.nodeOptions.ignore_m2x_options) { + return this._super(...arguments); + } + var m2o_dialog_opt = is_option_set(this.nodeOptions.m2o_dialog) || (_.isUndefined(this.nodeOptions.m2o_dialog) && @@ -112,6 +116,10 @@ odoo.define("web_m2x_options.web_m2x_options", function (require) { _search: function (search_val) { var self = this; + if (self.nodeOptions.ignore_m2x_options) { + return this._super(...arguments); + } + var def = new Promise((resolve) => { // Add options limit used to change number of selections record // returned. @@ -127,10 +135,7 @@ odoo.define("web_m2x_options.web_m2x_options", function (require) { self.field_color = self.nodeOptions.field_color; self.colors = self.nodeOptions.colors; - const context = Object.assign( - self.record.getContext(self.recordParams), - self.additionalContext - ); + var context = self.record.getContext(self.recordParams); var domain = self.record.getDomain(self.recordParams); var blacklisted_ids = self._getSearchBlacklist(); @@ -375,6 +380,10 @@ odoo.define("web_m2x_options.web_m2x_options", function (require) { }), _onDeleteTag: function (event) { + if (this.nodeOptions.ignore_m2x_options) { + return this._super(...arguments); + } + var result = this._super.apply(this, arguments); event.stopPropagation(); return result; @@ -383,7 +392,7 @@ odoo.define("web_m2x_options.web_m2x_options", function (require) { _onOpenBadge: function (event) { var self = this; var open = self.nodeOptions && is_option_set(self.nodeOptions.open); - if (open) { + if (!self.nodeOptions.ignore_m2x_options && open) { var context = self.record.getContext(self.recordParams); var id = parseInt($(event.currentTarget).data("id"), 10); @@ -442,7 +451,11 @@ odoo.define("web_m2x_options.web_m2x_options", function (require) { _onOpenRecord: function (ev) { var self = this; var open = this.nodeOptions.open; - if (open && self.mode === "readonly") { + if ( + !this.nodeOptions.ignore_m2x_options && + open && + self.mode === "readonly" + ) { ev.stopPropagation(); var id = ev.data.id; var res_id = self.record.data[self.name].data.filter( @@ -467,6 +480,10 @@ odoo.define("web_m2x_options.web_m2x_options", function (require) { }), _onOpenBadge: function (event) { + if (this.nodeOptions.ignore_m2x_options) { + return this._super(...arguments); + } + var open = is_option_set(this.nodeOptions.open); var no_color_picker = is_option_set(this.nodeOptions.no_color_picker); this._super.apply(this, arguments);