Odoo Help

Welcome!

This community 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.

0

Send Email from Template When convert_opportunity sends duplicate mails

By
Cyrus Waithaka
on 5/6/16, 10:58 AM 184 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? 

Your Answer

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

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

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