From 6e1b51ca4238a71f95708f91ea2e5becf3828204 Mon Sep 17 00:00:00 2001 From: Stephane Wirtel Date: Tue, 27 Apr 2010 15:57:44 +0200 Subject: [PATCH] [FIX] If the history of a case is empty, we can't send the message_id in the X-Headers bzr revid: stephane@openerp.com-20100427135744-0z46dbqhb3opky6y --- addons/crm/wizard/crm_send_email.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/crm/wizard/crm_send_email.py b/addons/crm/wizard/crm_send_email.py index a0f91fb2ae5..c17a114e3d3 100644 --- a/addons/crm/wizard/crm_send_email.py +++ b/addons/crm/wizard/crm_send_email.py @@ -76,7 +76,8 @@ class crm_send_new_email(osv.osv_memory): case = case_pool.browse(cr, uid, res_id) if context.get('mail', 'new') == 'new': - message_id = case.history_line[0].message_id + if len(case.history_line): + message_id = case.history_line[0].message_id else: hist = hist_obj.browse(cr, uid, res_id) message_id = hist.message_id @@ -92,9 +93,10 @@ class crm_send_new_email(osv.osv_memory): case_pool._history(cr, uid, [case], _('Send'), history=True, email=data['email_to'], details=body, email_from=email_from, message_id=message_id) x_headers = { - 'References':"%s" % (message_id), 'Reply-To':"%s" % case.section_id.reply_to, } + if message_id: + 'References':"%s" % (message_id) flag = False if case.section_id and case.section_id.server_id: flag = smtp_pool.send_email(