Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Send Email when Task Assigned or Finished in OpenERP

Tags:

openerp

Is there a way to send an email to the person who where assigned a task in a project or to send an email to the project manager when the task is finished ?

I'm working on OpenERP v6.1.

Thanks for the replies

like image 590
Mhel Avatar asked Nov 09 '12 01:11

Mhel


1 Answers

You can override button object method,

    obj_mail_msg = self.pool.get('mail.message')
    obj_mail_server = self.pool.get('ir.mail_server')
    mail_server_ids = obj_mail_server.search(cr, uid, [], context=context)
    mail_server_record = obj_mail_server.browse(cr, uid, mail_server_ids)[0]
    obj_mail_msg.schedule_with_attach(cr, uid, 
                            email_from, 
                            email_to = [list of email], 
                            subject='Notification for Task',
                            body=tools.ustr(mail_body) or '', 
                            mail_server_id = mail_server_ids[0])

schedule_with_attach will create a massage in (settings > configuration > Email > Massages) and massage will be send by scheduler.

Hope it will Help.

like image 63
Atul Arvind Avatar answered Dec 10 '22 08:12

Atul Arvind