Iam trying to send an email to a potential customer when a lead converted to an opportunity. Here is my code.
def convert_opportunity(self, cr, uid, ids, partner_id, user_ids=False, section_id=False, context=None):
res = super(crm_lead, self).convert_opportunity(cr, uid, ids, partner_id, user_ids, section_id, context=context)
template_id = self.pool.get('ir.model.data').get_object(cr, uid, 'buildafrique_erp', 'opportunity_created')
message_id = self.pool.get('email.template').send_mail(cr, uid, template_id.id, context['active_id'], force_send=True, context=context)
However, the email that is sent is in duplicate, sometimes, four times when I convert one lead to an opportunity. Any Ideas what is causing this?
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
About This Community
|Asked: 5/6/16, 10:58 AM|
|Seen: 185 times|
|Last updated: 5/6/16, 10:58 AM|