Odoo Help


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.


how to send automatic mail when task created ?

Ketul prajapati
on 4/8/16, 7:03 AM 275 views


import template_task




'name': 'ProjectTask',

'version': '1.1',

'depends': ['project'],

'data': ['task_email_template_data.xml'],

'installable': True,

'auto_install': False,

'application': True,




from openerp import api,fields,models

class task(models.Model):

_inherit = 'project.task'


def create(self,vals):




return res


def task_send_mail(self):

mail_ids = []

mail_pool = self.env['mail.mail']

template_id = self.env['ir.model.data'].get_object_reference('task_templatess','task_email_template')[1]

email_obj = self.env['mail.template'].browse(template_id)

mail_id = email_obj.send_mail(template_id)




if mail_ids:

res = mail_pool.send(self,mail_ids)


return res 



<?xml version="1.0" encoding="utf-8"?>


<data noupdate="0">

<!--email template-->

<record id="task_email_template" model="mail.template">

<field name="name">Send Email project template</field>

<field name="email_from">pketul94@gmail.com</field>

<field name="subject">New Customer created ${object.name}</field>

<field name="email_to">${object.user_id.email}</field>

<field name="model_id" ref="task_templatess.model_project_task"/>

<field name="auto_delete" eval="True"/>

<field name="body_html"><![CDATA[






when i create a task its create and send mail but error is the "mail delivery fail" how to fix it 

why you doing extra coding. Task created Email Facility available only we have to configure that.

on 4/8/16, 7:48 AM
Ketul prajapati
On 4/8/16, 8:03 AM

Hello sir,

sir I provide my own template through mail and when i send mail system not take user mail address which i give. system take "demo.portal@yourcompny.example.com" and i don't know how to fetch the user email address 

On 4/8/16, 7:48 AM


Create automated action and Server action for Task.

When New Task is Generated then it will automatically send Email.

You can set Email Template,Trigger Time any Many More.

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)


Asked: 4/8/16, 7:03 AM
Seen: 275 times
Last updated: 4/8/16, 8:03 AM