Odoo Help

Welcome!

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.

1

How to done Message menu notification?

By
aneesh ATEES Infomedia Pvt Ltd
on 8/14/15, 6:05 AM 505 views

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

1

Tarek Mohamed Ibrahim

--Tarek Mohamed Ibrahim--
896
| 5 3 7
Gîza, Egypt
--Tarek Mohamed Ibrahim--

I am an old VFP developer on ERP

I have moved to 2p since Nov-2014 and started developing with Python on Odoo.

https://www.linkedin.com/profile/public-profile-settings?trk=prof-edit-edit-public_profile

tibrahim@2p.com.sa

Tarek Mohamed Ibrahim
On 8/14/15, 3:37 PM

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> 
this is the definition of next_resp field

        'next_resp':fields.many2one('res.users','Next responsible',),
and I'm using the email field in res.users.
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.


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)

Stats

Asked: 8/14/15, 6:05 AM
Seen: 505 times
Last updated: 8/17/15, 4:21 AM