Odoo Help

0

how to check a lead type is 'lead' or 'opportunity'?

By
Jothimani
on 5/26/14, 2:00 AM 852 views

Hello everyone,

here i want to check a lead type is 'lead' or 'opportunity' , and type is lead means send a mail,

here is my code,

    def _check_lead(self, cr, uid, ids, fields, args, context=None):
            for lead in self.browse(cr, uid, ids):

                if lead.type == 'lead':

                    sender = 'demo1@demo.com'
                    receivers = ['demo@demo.com']

                    message = """From: Administrator Test <administrator@demo.com>
                    To: To Person <demo@demo.com>
                    Subject: SMTP e-mail test

                    This is a test e-mail message.
                    """

                    try:
                       smtpObj = smtplib.SMTP('mail.demo.com',25)
                       smtpObj.login("administrator@demo.com", "password")
                       smtpObj.sendmail(sender, receivers, message)         
                    except SMTPException:
                       raise osv.except_osv(('Your mail was not send, because the Server connection was problem.'))
        return

 

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.

Register

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)

Stats

Asked: 5/26/14, 2:00 AM
Seen: 852 times
Last updated: 3/16/15, 8:10 AM