i have a custome module like project .i need to assiagn work to employee and that user need to get notification in his message .menu or anywhere this is my requirement.how can solve it?pls explain the solution
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Accounting
- Inventory
- PoS
- Project
- MRP
This question has been flagged
You have first to set the outgoing mail server on your odoo settings and test it is working
You need also to create an email template to use when sending to employees
here is a code I used to send emails to employees when the status of a document is changed. Employees are assinged to users in the systme
def mailing(self, cr, uid, ids,vals,context=None):
domain=[('name','=','MY_TEMPLATE_NAME')]
templates = self.pool.get('email.template').search(cr,uid,domain)
if not templates:
return
template = self.pool.get('email.template').browse(cr,uid,templates[0])
if template.email_to:
#template.body_html = 'this is a test for the x'
pr_id = self.browse(cr,uid,ids,context=context)[0].id
self.pool.get('email.template').send_mail(cr, uid, template.id, pr_id, True, context=context)
def write(self, cr, uid, ids, vals, context=None):
#for test only, comment when test succeeded
self.test = False
if self.test:
self.mailing(cr,uid,ids,vals,context)
return
#for test only, comment when test succeeded
it is triggered in the write method of a view after changing the status of the document
Here is the email_to field and the body_html fields
email_to
${object.next_resp.email}
body_html
Dear ${object.next_resp.name}, </p> <p> The document ${object.name} status has been changed to ${object.state}, pls check and take the appropriate action </p>
'next_resp':fields.many2one('res.users','Next responsible',),
I designed the code to save the user id in the 'next_resp' field that has to be notified when the document status is changed.
I posted my own solution, you have your own names and scenarios. I think this will be guide you for your similar case. You can add more specific questions in the comments until your solution work.
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign up