Merge PR #3067 into 14.0

Signed-off-by CarlosRoca13
pull/3119/head
OCA-git-bot 2025-02-06 12:06:14 +00:00
commit 84f06f726f
4 changed files with 34 additions and 7 deletions

View File

@ -7,7 +7,7 @@ web_m2x_options
!! This file is generated by oca-gen-addon-readme !! !! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !! !! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:1f28c92cd5c1a43185c582e5aa670e47dc78efced048df3c27bf0e77a0b1ad0d !! source digest: sha256:175ee076d100de2101690e681f8a5bbf768c8cb478a054af3d31f78b1ed4a4a5
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png .. |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) 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 ir.config_parameter options
~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -189,6 +193,7 @@ Contributors
* Carlos Roca * Carlos Roca
* Bhavesh Odedra <bodedra@opensourceintegrators.com> * Bhavesh Odedra <bodedra@opensourceintegrators.com>
* Dhara Solanki <dhara.solanki@initos.com> (http://www.initos.com) * Dhara Solanki <dhara.solanki@initos.com> (http://www.initos.com)
* Alexandre D. Díaz <alexandrediaz@grupoisonor.es>
Maintainers Maintainers
~~~~~~~~~~~ ~~~~~~~~~~~

View File

@ -12,3 +12,4 @@
* Carlos Roca * Carlos Roca
* Bhavesh Odedra <bodedra@opensourceintegrators.com> * Bhavesh Odedra <bodedra@opensourceintegrators.com>
* Dhara Solanki <dhara.solanki@initos.com> (http://www.initos.com) * Dhara Solanki <dhara.solanki@initos.com> (http://www.initos.com)
* Alexandre D. Díaz <alexandrediaz@grupoisonor.es>

View File

@ -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) 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 ir.config_parameter options
~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@ -98,6 +98,10 @@ odoo.define("web_m2x_options.web_m2x_options", function (require) {
FieldMany2One.include({ FieldMany2One.include({
_onInputFocusout: function () { _onInputFocusout: function () {
if (this.nodeOptions.ignore_m2x_options) {
return this._super(...arguments);
}
var m2o_dialog_opt = var m2o_dialog_opt =
is_option_set(this.nodeOptions.m2o_dialog) || is_option_set(this.nodeOptions.m2o_dialog) ||
(_.isUndefined(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) { _search: function (search_val) {
var self = this; var self = this;
if (self.nodeOptions.ignore_m2x_options) {
return this._super(...arguments);
}
var def = new Promise((resolve) => { var def = new Promise((resolve) => {
// Add options limit used to change number of selections record // Add options limit used to change number of selections record
// returned. // returned.
@ -127,10 +135,7 @@ odoo.define("web_m2x_options.web_m2x_options", function (require) {
self.field_color = self.nodeOptions.field_color; self.field_color = self.nodeOptions.field_color;
self.colors = self.nodeOptions.colors; self.colors = self.nodeOptions.colors;
const context = Object.assign( var context = self.record.getContext(self.recordParams);
self.record.getContext(self.recordParams),
self.additionalContext
);
var domain = self.record.getDomain(self.recordParams); var domain = self.record.getDomain(self.recordParams);
var blacklisted_ids = self._getSearchBlacklist(); var blacklisted_ids = self._getSearchBlacklist();
@ -375,6 +380,10 @@ odoo.define("web_m2x_options.web_m2x_options", function (require) {
}), }),
_onDeleteTag: function (event) { _onDeleteTag: function (event) {
if (this.nodeOptions.ignore_m2x_options) {
return this._super(...arguments);
}
var result = this._super.apply(this, arguments); var result = this._super.apply(this, arguments);
event.stopPropagation(); event.stopPropagation();
return result; return result;
@ -383,7 +392,7 @@ odoo.define("web_m2x_options.web_m2x_options", function (require) {
_onOpenBadge: function (event) { _onOpenBadge: function (event) {
var self = this; var self = this;
var open = self.nodeOptions && is_option_set(self.nodeOptions.open); 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 context = self.record.getContext(self.recordParams);
var id = parseInt($(event.currentTarget).data("id"), 10); 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) { _onOpenRecord: function (ev) {
var self = this; var self = this;
var open = this.nodeOptions.open; var open = this.nodeOptions.open;
if (open && self.mode === "readonly") { if (
!this.nodeOptions.ignore_m2x_options &&
open &&
self.mode === "readonly"
) {
ev.stopPropagation(); ev.stopPropagation();
var id = ev.data.id; var id = ev.data.id;
var res_id = self.record.data[self.name].data.filter( 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) { _onOpenBadge: function (event) {
if (this.nodeOptions.ignore_m2x_options) {
return this._super(...arguments);
}
var open = is_option_set(this.nodeOptions.open); var open = is_option_set(this.nodeOptions.open);
var no_color_picker = is_option_set(this.nodeOptions.no_color_picker); var no_color_picker = is_option_set(this.nodeOptions.no_color_picker);
this._super.apply(this, arguments); this._super.apply(this, arguments);