diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index e53bcc7c6bd..c7e14a2fb0a 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -685,6 +685,7 @@ openerp.mail = function(session) { /* Display the message if if the msg_id don't exists. * If the record have a parent, insert parent or inside parent */ message_treat_new_data: function(records) { + console.log(this, records); var self=this; _(records.reverse()).each(function (record) { if(!self.browse_thread({'id':record.id, 'model':record.model})){ @@ -709,9 +710,12 @@ openerp.mail = function(session) { var body = comment_node.val(); comment_node.val(''); } - return this.ds_thread.call('message_post_api', [ - [this.context.default_res_id], body, false, 'comment', false, this.context.default_parent_id, undefined]) - .then(this.proxy('message_treat_new_data')); + if(body.match(/\S+/)) + return this.ds_thread.call('message_post_api', [ + [this.context.default_res_id], body, false, 'comment', false, this.context.default_parent_id, undefined]) + .then(this.proxy('message_treat_new_data')); + else + return false; }, /** Action: 'shows more' to fetch new messages */ diff --git a/addons/mail/wizard/mail_compose_message.py b/addons/mail/wizard/mail_compose_message.py index 32d361a3126..1ea8383eaea 100644 --- a/addons/mail/wizard/mail_compose_message.py +++ b/addons/mail/wizard/mail_compose_message.py @@ -217,6 +217,10 @@ class mail_compose_message(osv.TransientModel): def send_mail(self, cr, uid, ids, context=None): """ Process the wizard content and proceed with sending the related email(s), rendering any template patterns on the fly if needed. """ + + print "" + print "send_mail", ids, context + if context is None: context = {} active_ids = context.get('active_ids') @@ -225,6 +229,9 @@ class mail_compose_message(osv.TransientModel): mass_mail_mode = wizard.composition_mode == 'mass_mail' active_model_pool = self.pool.get(wizard.model if wizard.model else 'mail.thread') + if wizard.body_text==False: + return False + # wizard works in batch mode: [res_id] or active_ids res_ids = active_ids if mass_mail_mode and wizard.model and active_ids else [wizard.res_id] for res_id in res_ids: diff --git a/addons/mail/wizard/mail_compose_message_view.xml b/addons/mail/wizard/mail_compose_message_view.xml index 2899c0c9a41..0f384dc5a0d 100644 --- a/addons/mail/wizard/mail_compose_message_view.xml +++ b/addons/mail/wizard/mail_compose_message_view.xml @@ -75,7 +75,7 @@
-