diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index 824a6397dff7749a602d5f593206cd50e307763e..25a6c1e8e54f0d93e638a0703f36fdda7169bd97 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -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 () {