[FIX]: crm: Added checking for section_id in send mail wizard because some objects which don't have section_id uses this wizard

bzr revid: rpa@tinyerp.com-20100810114218-afd2ov1x3f02q210
This commit is contained in:
rpa (Open ERP)
2010-08-10 17:12:18 +05:30
parent 092d59adff
commit 8439e0be29
+4 -2
View File
@@ -177,7 +177,8 @@ class crm_send_new_email(osv.osv_memory):
if 'email_from' in fields:
res.update({'email_from': user_mail_from and tools.ustr(user_mail_from) or ''})
if 'reply_to' in fields:
res.update({'reply_to': case.section_id and case.section_id.reply_to or False})
if hasattr(case, 'section_id'):
res.update({'reply_to': case.section_id and case.section_id.reply_to or False})
if 'subject' in fields:
res.update({'subject': tools.ustr(context.get('subject', case.name) or '')})
if 'email_cc' in fields:
@@ -236,7 +237,8 @@ class crm_send_new_email(osv.osv_memory):
email_cc = (case.email_cc and tools.ustr(case.email_cc) + ', ' or '') + (hist.email_cc or '')
res.update({'email_cc': email_cc})
if 'reply_to' in fields:
res.update({'reply_to': case.section_id.reply_to})
if hasattr(case, 'section_id'):
res.update({'reply_to': case.section_id.reply_to})
if 'state' in fields:
res['state'] = u'pending'
return res