[IMP] crm: send_mail_to_salesman method , call schedule_with_attach instead of direct send email

bzr revid: hmo@tinyerp.com-20110421080908-c3oc32kkwdygb2e4
This commit is contained in:
Harry (OpenERP) 2011-04-21 13:39:08 +05:30
parent 0577796333
commit 1a404f0c96
1 changed files with 4 additions and 6 deletions

View File

@ -143,15 +143,13 @@ class crm_lead2opportunity_partner(osv.osv_memory):
def send_mail_to_salesman(self, lead):
email_to = lead.user_id and lead.user_id.user_email
if not email_to:
return
return False
message_pool = self.pool.get('email.message')
email_from = lead.section_id and lead.section_id.user_id and lead.section_id.user_id.user_email or email_to
partner = lead.partner_id and lead.partner_id.name or lead.partner_name
subject = "lead %s converted into opportunity" % lead.name
body = "Info \n Id : %s \n Subject: %s \n Partner: %s \n Description : %s " % (lead.id, lead.name, lead.partner_id.name, lead.description)
try :
tools.email_send(email_from, [email_to], subject, body)
except:
pass
body = "Info \n Id : %s \n Subject: %s \n Partner: %s \n Description : %s " % (lead.id, lead.name, lead.partner_id.name, lead.description)
return message_pool.schedule_with_attach(cr, uid, email_from, [email_to], subject, body)
def action_apply(self, cr, uid, ids, context=None):
"""