Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
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 = 'firstname.lastname@example.org'
receivers = ['email@example.com']
message = """From: Administrator Test <firstname.lastname@example.org>
To: To Person <email@example.com>
Subject: SMTP e-mail test
This is a test e-mail message.
smtpObj = smtplib.SMTP('mail.demo.com',25)
smtpObj.sendmail(sender, receivers, message)
raise osv.except_osv(('Your mail was not send, because the Server connection was problem.'))