This question has been flagged
1 Reply
26178 Views

How to change the default email template when using "Send by email" on a quotation, sales order, purchase, invoice or other business documents?

For example;

  • you accidentally deleted the original built-in quotation email template.
    Now, when you hit "Send by email" you have to select the new email template by hand each time because the default is empty and you need to reset the default. 

  • your customer has its own custom email templates and he wants to set it as the default when hitting "Send by email"  instead of manually selecting it each time. 


Avatar
Discard

that is a very clear explanation.
I wonder why, for a simple action like changing a default template, still in ODOO V15, the user shall go thru such nightmare...

Another approach is (1) Copy the default template. (2) Rename the original so you know it is custom, and make any edits you like. This will be the template that is the default, since it is really still the original, just with changes. (3) Rename the copy with (original) at the end, so you have it in case the one you modify is not suitable for all Use Cases. We recommend taking a copy just so you will always have a working template, but this isn't even necessary for everyone - the default template is a default, and any edits you make will persist during upgrades.

Author Best Answer

Let's consider the case in which we want to change the default email template Sales order: Confirmation Email on a sales order (screenshot below).


Here are the steps to follow;

1. Activate debug mode

2. Go in Settings -> Technical -> Emails -> Templates

Open the new email template that you wish to set as default. 
In its URL (check that you are on debug mode) find the id number of the email template


In this example the id of your email template is 78.

Repeat this and also get the id of the original email template (here let’s say its 54)


3. Then go back in Settings -> Technical -> Sequence & Identifiers -> External Identifiers
Search on the 1) record id of the original default email template that you want to replace (ex 54 here)
+ add a filter on 2) external identifiers with the value "template" 

Open the right record according to what you want to change.


Indicate the new id = 78 (for this example) and save.
Note that the Record (name of the email template) updated into the new default email template that you chose.



4. Make first a copy the original default email template, then delete the original.

Without this step, the default won't change properly. You still want to keep the original on hand just in case you need it later.

5. Check out that it worked 



The default is set as your new report (here Sales Order: Confirmation email (custom copy))


NB: If you have mistakenly deleted the original built-in default email template BEFORE changing its id record in the external identifier into the new email template id,

then the external identifier will be deleted as well.

No panic, you can just recreate the external identifier. For that use a test database, locate the external id linked to the original report and reproduce the external ID in your db + link it with the right record id.

Avatar
Discard

Very useful and well explained! Thank you Laure!

Hi Laure. Perfect explanation! However, one question, when I change my 'default' template let's call it, this changes for all companies within my multi-company set-up. Is there a way to do this per company?

Be sure to check the External ID of the template that appears in USE TEMPLATE is actually "sale.mail_template_sale_confirmation" (template named "Sales Order: Confirmation Email") because in some configurations it may be "sale.email_template_edi_sale" instead (template named "Sales Order: Send by email") so THAT is the one you want to change with the ID of the one you made.

Dear Laure! Thank you for the very clear explanation! Is it possible to do this and have default email templates on a per company level on v16?