Community: Framework mailing list archives
Re: Email templates and auto_delete flag inconsistencyby
Vauxoo S.A. de C.V., Nhomar Hernandez
On Fri, Aug 1, 2014 at 3:56 PM, Maxim Litnitskiy <email@example.com> wrote:
Hi dear Developers!I am testing 8.0 but I think this is the same in trunk.Imagine the most usual situation - new lead auto reply with email_template "Thanks for your interest".Let this email_template has auto_delete = True.We also have automated action on new lead creation with server action Send email with "thank you" template having auto_delete = True.So thank you email is sent to customer and both mail.mail and mail.message are deleted due to auto_delete flag.Here comes the issue.When customer replies mail_thread.message_route cannot route this mail to existing lead and creates a new lead instead.This is because there is no mail.message with such message_id (as sent mail.mail and mail.message were deleted).If we set email_template.auto_delete = False the system keeps both sent mail.mail and creates mail.message.When customer replies his reply gets the correct route as message_id is found:msg_references = thread_references.split()
mail_message_ids = mail_msg_obj.search(cr, uid, [('message_id', 'in', msg_references)], context=context)Now imagine that we do not use automated action and instead manually send 'thank you' email to customer from newly created lead.Despite the fact email_template.auto_delete = True the system creates mail.message and deletes mail.mail after successful delivery.In this case customer's reply can find the correct route to existing lead.So as far as I can understand in the 2-nd case we first create mail.message and keep it. In the 1-st case we first create mail.mail and after that mail.message but when we delete mail.mail mail.message is deleted.How can this be solved?Thanks for your attenstion.
IMHO this is a valid bug.
You should make public a issue in github, and create a test yaml to validate your point, it should be a great approach, if you are not technical it can be at least managed by the right people.
The bad news is that the change of the field definition in an extra module is not configurable due to the "ondelete" definition.
Did you try remove the ondelete attribute in a new db to validate your hipotesis?
Technically we have 2 solutions .
1.- An extra logger with id of sent messages (uggly) and what if I need a new lead per mass mailing?.
2.- Don't autodelete and mantain tracj of your campaing from the first email in advance.
I am not CRM specialist, this are just thoughts.