[FIX] web: Dialog: avoid triggering "closing" twice.
This commit is contained in:
@@ -156,7 +156,7 @@ instance.web.Dialog = instance.web.Widget.extend({
|
||||
'keyboard': true,
|
||||
});
|
||||
if (options.size !== 'large'){
|
||||
var dialog_class_size = this.$dialog_box.find('.modal-lg').removeClass('modal-lg')
|
||||
var dialog_class_size = this.$dialog_box.find('.modal-lg').removeClass('modal-lg');
|
||||
if (options.size === 'small'){
|
||||
dialog_class_size.addClass('modal-sm');
|
||||
}
|
||||
@@ -169,7 +169,7 @@ instance.web.Dialog = instance.web.Widget.extend({
|
||||
}
|
||||
$dialog_content.openerpClass();
|
||||
|
||||
this.$dialog_box.on('hidden.bs.modal', this, function(){
|
||||
this.$dialog_box.on('hidden.bs.modal', this, function() {
|
||||
self.close();
|
||||
});
|
||||
this.$dialog_box.modal('show');
|
||||
@@ -179,13 +179,15 @@ instance.web.Dialog = instance.web.Widget.extend({
|
||||
return res;
|
||||
},
|
||||
/**
|
||||
Closes the popup, if destroy_on_close was passed to the constructor, it is also destroyed.
|
||||
Closes (hide) the popup, if destroy_on_close was passed to the constructor, it will be destroyed instead.
|
||||
*/
|
||||
close: function(reason) {
|
||||
if (this.dialog_inited) {
|
||||
if (this.dialog_inited && !this.__tmp_dialog_hiding) {
|
||||
this.trigger("closing", reason);
|
||||
if (this.$el.is(":data(bs.modal)")) { // may have been destroyed by closing signal
|
||||
this.$el.parents('.modal').modal('hide');
|
||||
this.__tmp_dialog_hiding = true;
|
||||
this.$dialog_box.modal('hide');
|
||||
this.__tmp_dialog_hiding = undefined;
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -221,7 +223,7 @@ instance.web.Dialog = instance.web.Widget.extend({
|
||||
opened_modal.pop().remove();
|
||||
if (opened_modal.length > 0){
|
||||
//we still have other opened modal so we should focus it
|
||||
opened_modal[opened_modal.length-1].focus()
|
||||
opened_modal[opened_modal.length-1].focus();
|
||||
}
|
||||
},0);
|
||||
}
|
||||
@@ -247,8 +249,7 @@ instance.web.CrashManager = instance.web.Class.extend({
|
||||
this.show_warning({type: "Session Expired", data: { message: _t("Your OpenERP session expired. Please refresh the current web page.") }});
|
||||
return;
|
||||
}
|
||||
if (error.data.exception_type === "except_osv" || error.data.exception_type === "warning"
|
||||
|| error.data.exception_type === "access_error") {
|
||||
if (error.data.exception_type === "except_osv" || error.data.exception_type === "warning" || error.data.exception_type === "access_error") {
|
||||
this.show_warning(error);
|
||||
} else {
|
||||
this.show_error(error);
|
||||
|
||||
Reference in New Issue
Block a user