[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
This commit is contained in:
Stephane Wirtel
2010-04-27 15:57:44 +02:00
parent 3db55f83a1
commit 6e1b51ca42
+4 -2
View File
@@ -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(