Skip to Content
Menú
This question has been flagged
3 Respostes
2476 Vistes

Dear Community I'm using odoo v15. I need a reminder alert for birthday . HR user may get alert of employee in his/her top alert bell icon when some one birthday is due . No need for automated email to emplyee just an alert for HR user.


Regards

Avatar
Descartar
Best Answer

Yes, the code snippet you provided demonstrates how to implement a notification system using Python in an object that inherits from mail.thread in Odoo. By adding this code to a method in your object, you can search for records with a specific birthday date and create a notification message using the mail.message model. This allows you to send notifications with a customized body and subject.

Remember to adjust the code according to your specific model and requirements, including the field names and the content of the notification message.


Avatar
Descartar
Autor Best Answer

@Said Gourida,

Thank you for your prompt response. Can you share me working code along with file where I need to put this code. I don't want email to be sent but to generate an alert reminder to HR user for birthday. 


Regards

Avatar
Descartar
Best Answer

yes you can do this by python side  like this :

inherit mail.thread object into your object.

and on the any action wherever you want add the code like 

@api.multi
def your_method(self):
    res = self.env['your_model'].search([("birthday_date","=",datetime.strftime(datetime.now(),"%d-%m-%Y"))]    
    for req in res:
        self.env['mail.message'].create({
'message_type': "notification",
'body': "Your Body",
'subject': "Your Subject",
    ....)}

i hope this will help you


Avatar
Descartar
Related Posts Respostes Vistes Activitat
2
d’oct. 25
2874
1
de set. 25
2870
3
de jul. 25
4209
1
de maig 25
2302
4
de maig 25
3664