diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index ba26cc9d580..bb1a8067644 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -585,11 +585,11 @@ openerp.mail = function (session) { */ on_compose_expandable: function (event) { - if ((!this.stay_open || event.type == 'click') && (!this.show_composer || !this.$('textarea:not(.oe_compact)').val().match(/\S+/))) { + if ((!this.stay_open || (event && event.type == 'click')) && (!this.show_composer || !this.$('textarea:not(.oe_compact)').val().match(/\S+/))) { this.show_composer = !this.show_composer || this.stay_open; this.reinit(); } - if (!this.stay_open && this.show_composer && event.type != 'blur') { + if (!this.stay_open && this.show_composer && (!event || event.type != 'blur')) { this.$('textarea:not(.oe_compact):first').focus(); } return true;