Browse Source

Merge pull request #1155 from Tecnativa/11.0-web_m2x_options-fix_m2m_tags_list_view

[FIX] web_m2x_options: Fix error in tree views with many2many_tags
pull/1158/head
Pedro M. Baeza 6 years ago
committed by GitHub
parent
commit
8bf48e984e
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 28
      web_m2x_options/static/src/js/form.js

28
web_m2x_options/static/src/js/form.js

@ -9,10 +9,12 @@ odoo.define('web_m2x_options.web_m2x_options', function (require) {
Dialog = require('web.Dialog'),
view_dialogs = require('web.view_dialogs'),
relational_fields = require('web.relational_fields'),
FieldMany2One = relational_fields.FieldMany2One,
rpc = require('web.rpc');
var _t = core._t,
FieldMany2ManyTags = relational_fields.FieldMany2ManyTags,
rpc = require('web.rpc'),
_t = core._t;
FieldMany2One = relational_fields.FieldMany2One,
FormFieldMany2ManyTags = relational_fields.FormFieldMany2ManyTags;
var web_m2x_options = rpc.query({
model: "ir.config_parameter",
@ -301,7 +303,6 @@ odoo.define('web_m2x_options.web_m2x_options', function (require) {
_onOpenBadge: function (event) {
var self = this;
var open = (self.nodeOptions && self.is_option_set(self.nodeOptions.open));
var no_color_picker = (self.nodeOptions && self.is_option_set(self.nodeOptions.no_color_picker));
if (open) {
var context = self.record.getContext(self.recordParams);
var id = parseInt($(event.currentTarget).data('id'), 10);
@ -350,9 +351,24 @@ odoo.define('web_m2x_options.web_m2x_options', function (require) {
}).open();
})
}
} else if (!no_color_picker) {
self._onOpenColorPicker(event);
}
},
})
FormFieldMany2ManyTags.include({
events: _.extend({}, FormFieldMany2ManyTags.prototype.events, {
'click .badge': '_onOpenBadge',
}),
_onOpenBadge: function (event) {
var open = this.is_option_set(this.nodeOptions.open);
var no_color_picker = this.is_option_set(
this.nodeOptions.no_color_picker
);
this._super.apply(this, arguments);
if (!open && !no_color_picker) {
this._onOpenColorPicker(event);
}
},
});
});
Loading…
Cancel
Save