Odoo Help


Send Email from Template When convert_opportunity sends duplicate mails

Cyrus Waithaka
on 5/6/16, 10:58 AM 623 views

Hi people,

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)
return res

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? 

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 5/6/16, 10:58 AM
Seen: 623 times
Last updated: 5/6/16, 10:58 AM