Skip to Content
Menu
This question has been flagged
3 Replies
2432 Views

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
Discard
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
Discard
Author 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
Discard
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
Discard
Related Posts Replies Views Activity
2
Oct 25
2702
1
Sep 25
2691
3
Jul 25
4105
1
May 25
2202
4
May 25
3553