Ir al contenido
Menú
Se marcó esta pregunta
3 Respuestas
2431 Vistas

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
Mejor respuesta

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 Mejor respuesta

@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
Mejor respuesta

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
Publicaciones relacionadas Respuestas Vistas Actividad
2
oct 25
2697
1
sept 25
2687
3
jul 25
4102
1
may 25
2199
4
may 25
3552