I'm trying to send email from code like this in a custom addon when i push a button on a Purchase Order form, there is only a problem... body result empty... i can't undestand where is the error... Anyone can help me?
def req_aut(self, cr, uid, ids, context=None):
pur_ord = self.read(cr, uid, ids, ['name'], context=context)[0]
subject="subject: "+ pur_ord['name']
body="body"
message_obj = self.pool.get('mail.message')
email_to=[]
email_to.append('a@a.it')
msg_vals = {
'subject': subject,
'date': time.strftime('%Y-%m-%d %H:%M:%S'),
'user_id': uid,
'body_text': False,
'body_html': body,
'email_from': 'appo@appo.it',
'email_to': email_to,
'subtype': 'html',
'state': 'outgoing',
}
msg_id = message_obj.create(cr, uid, msg_vals, context)