diff --git a/src/common.js b/src/common.js index 2fbdfbf89b..f1e709ebee 100644 --- a/src/common.js +++ b/src/common.js @@ -2171,7 +2171,10 @@ return prm; }, close: function(dialog) { - dialog.modal('hide').remove(); + dialog.on('hidden.bs.modal', function(event) { + jQuery(this).remove(); + }); + dialog.modal('hide'); this.running = false; } }); diff --git a/src/view.js b/src/view.js index 7077309628..b81789a3f6 100644 --- a/src/view.js +++ b/src/view.js @@ -3486,7 +3486,10 @@ var record = this.record(); var close = function() { - file_dialog.modal('hide').remove(); + file_dialog.on('hidden.bs.modal', function(event) { + jQuery(this).remove(); + }); + file_dialog.modal('hide'); }; var save_file = function() { diff --git a/src/window.js b/src/window.js index 1c5bc20df6..84bf4efa7c 100644 --- a/src/window.js +++ b/src/window.js @@ -204,6 +204,9 @@ this.el.modal('show'); this.screen.display(); }.bind(this)); + this.el.on('hidden.bs.modal', function(event) { + jQuery(this).remove(); + }); }, add: function() { @@ -316,7 +319,7 @@ // Empty when opening from Many2One this.screen.switch_view(this.prev_view.view_type); } - this.el.modal('hide').remove(); + this.el.modal('hide'); } }); @@ -425,6 +428,9 @@ } }.bind(this)); }.bind(this)); + this.el.on('hidden.bs.modal', function(event) { + jQuery(this).remove(); + }); }, response: function(response_id) { var records; @@ -454,7 +460,7 @@ this.callback(null); } }; - this.el.modal('hide').remove(); + this.el.modal('hide'); new Sao.Window.Form(screen, callback.bind(this), { new_: true }); @@ -468,7 +474,7 @@ } } this.callback(value); - this.el.modal('hide').remove(); + this.el.modal('hide'); } }); @@ -536,6 +542,9 @@ body.append(this.screen.screen_container.el); this.el.modal('show'); }; + this.el.on('hidden.bs.modal', function(event) { + jQuery(this).remove(); + }); this.screen.model.execute('get_preferences_fields_view', [], {}) .then(set_view.bind(this), this.destroy); @@ -570,7 +579,7 @@ prm.done(end); }, destroy: function() { - this.el.modal('hide').remove(); + this.el.modal('hide'); } }); @@ -641,6 +650,9 @@ })); }.bind(this)); this.el.modal('show'); + this.el.on('hidden.bs.modal', function(event) { + jQuery(this).remove(); + }); }, response: function(response_id) { var revision = null; @@ -650,7 +662,7 @@ revision = Sao.DateTime(parseInt(revision, 10)); } } - this.el.modal('hide').remove(); + this.el.modal('hide'); this.callback(revision); } }); diff --git a/src/wizard.js b/src/wizard.js index 9ceeb69794..f9b2ab41a3 100644 --- a/src/wizard.js +++ b/src/wizard.js @@ -255,7 +255,10 @@ }, destroy: function(action) { Sao.Wizard.Dialog._super.destroy.call(this); - this.dialog.modal('hide').remove(); + this.dialog.on('hidden.bsd.modal', function(event) { + jQuery(this).remove(); + }); + this.dialog.modal('hide'); var dialog = jQuery('.wizard-dialog').filter(':visible')[0]; var is_menu = false; var screen;