diff options
| author | Denis Ledoux <dle@odoo.com> | 2015-01-15 19:03:20 +0100 |
|---|---|---|
| committer | Denis Ledoux <dle@odoo.com> | 2015-01-15 19:04:05 +0100 |
| commit | 84b5bf94bd59b3be528d2d667e9aa76d8a8fd957 (patch) | |
| tree | 9b1a0a7833ed2abc7a7d6baf7c33caded72638a4 /addons/mail/static/src/js | |
| parent | 67959566edc87885ec4b7e31807d48514a7b5944 (diff) | |
[IMP] mail: prevent leaving when composing a message
Diffstat (limited to 'addons/mail/static/src/js')
| -rw-r--r-- | addons/mail/static/src/js/mail.js | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index 824a6397dff..25a6c1e8e54 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 () { |
