Skip to content

Commit 45cf691

Browse files
committed
[FIX]web_m2x_options: prevent popup to open web badger is deleted
1 parent f3caf0b commit 45cf691

File tree

1 file changed

+19
-9
lines changed
  • web_m2x_options/static/src/js

1 file changed

+19
-9
lines changed

web_m2x_options/static/src/js/form.js

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,14 @@ odoo.define('web_m2x_options.web_m2x_options', function (require) {
265265
this.events["click .badge"] = "open_badge";
266266
return this._super.apply(this, arguments);
267267
},
268+
events: {
269+
'click .o_delete': function(e) {
270+
this.remove_id($(e.target).parent().data('id'));
271+
},
272+
'click .o_badge_text': 'open_badge',
273+
'mousedown .o_colorpicker span': 'update_color',
274+
'focusout .o_colorpicker': 'close_color_picker',
275+
},
268276
show_error_displayer: function () {
269277
if ((typeof this.options.m2o_dialog === 'undefined' && this.can_create) ||
270278
this.options.m2o_dialog) {
@@ -408,15 +416,17 @@ odoo.define('web_m2x_options.web_m2x_options', function (require) {
408416
var self = this;
409417
var open = (self.options && self.is_option_set(self.options.open));
410418
if(open){
411-
self.mutex.exec(function(){
412-
var id = parseInt($(ev.currentTarget).data('id'), 10);
413-
self.do_action({
414-
type: 'ir.actions.act_window',
415-
res_model: self.field.relation,
416-
views: [[false, 'form']],
417-
res_id: id,
418-
target: "new"
419-
});
419+
this.mutex.exec(function(){
420+
var id = parseInt($(ev.target).parent().data('id'), 10);
421+
if(id){
422+
self.do_action({
423+
type: 'ir.actions.act_window',
424+
res_model: self.field.relation,
425+
views: [[false, 'form']],
426+
res_id: id,
427+
target: "new"
428+
});
429+
}
420430
}.bind(this));
421431
}else{
422432
self.open_color_picker(ev);

0 commit comments

Comments
 (0)