Ir al contenido
Menú
Se marcó esta pregunta
2 Respuestas
1695 Vistas

how we can have Odoo send an email notification of when an activity has come to its due date. For right now this is needed in CRM app, for the activities on Opportunities.

 

The notification should go to the person assigned to the activity. As you can see below, I have a To Do on the below opportunity due today, I would like that Odoo sends me an email telling me I have this To Do today.

I have tried it with automated actions but its not triggering. Please advice me on how to get it working or if I could try it another way. 

New to Odoo - Thank you in advance.

Avatar
Descartar
Autor Mejor respuesta

Creyox Technologies - Thank you so much! I will try this.

This code below is working when I run it manually but my scheduled action is not triggering automatically. scheduler user is set to me but for rest of the scheduled actions its OdooBot. Why am I facing this issue and how to solve this?


Im using odoo 15 on odoosh which we moved recently, below is the minified code. I dont have access to github and all as im new to this at my office


Code: template = env['mail.template'].search([('name', '=', 'Test - Due date reminder for CRM Activity')], limit=1);

if not template.exists(): raise UserError("Template 'Test - Due date reminder for CRM Activity' not found!");

activities = env['mail.activity'].search([('res_model', '=', 'crm.lead'), ('date_deadline', '=', datetime.date.today()), ('user_id', '!=', False)]);

log_messages = [];

[log_messages.append(f"Preparing email for activity: {activity.id} User: {activity.user_id.name}") or (email_content := f"<p>Dear {activity.user_id.name},</p><p>This is a reminder that you have an activity due today.</p><p>Opportunity: {activity.res_name}</p><p>Activity Type: {activity.activity_type_id.name}</p><p>Due Date: {activity.date_deadline}</p><p>Activity Subject: {activity.summary}</p><p>Description: {activity.note or 'No additional notes.'}</p><p>Thank you!</p>", email_subject := f"Reminder: You have an activity due today for {activity.activity_type_id.name}", email := env['mail.mail'].create({'subject': email_subject, 'body_html': email_content, 'email_to': activity.user_id.email, 'auto_delete': False}), email.send(), log_messages.append(f"Email sent to: {email.email_to} for activity: {activity.id}") if not log_messages else None) for activity in activities];

if log_messages: raise UserError("\n".join(log_messages))


Avatar
Descartar
Mejor respuesta

Hello Prasath,

You can set up a scheduled action to notify users via email about upcoming activity due dates.

Thanks,
info@creyox.com

Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
0
dic 24
1085
2
jul 24
2017
1
may 24
2458
0
dic 15
3346
0
jun 25
6879