[IMP] mail: prevent leaving when composing a message

This commit is contained in:
Denis Ledoux 2015-01-15 19:03:20 +01:00
parent 67959566ed
commit 84b5bf94bd
1 changed files with 10 additions and 0 deletions

View File

@ -408,6 +408,16 @@ openerp.mail = function (session) {
this.is_log = false;
this.recipients = [];
this.recipient_ids = [];
session.web.bus.on('clear_uncommitted_changes', this, function(e) {
if (this.show_composer && !e.isDefaultPrevented()){
if (!confirm(_t("You are currently composing a message, your message will be discarded.\n\nAre you sure you want to leave this page ?"))) {
e.preventDefault();
}
else{
this.on_cancel();
}
}
});
},
start: function () {