Skip to Content
Menu
This question has been flagged
6 Replies
41112 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?

Best Answer

thank you very useful.
it works on odoo v17

Avatar
Discard
Best Answer

Hey guys i am on version 18 and i did everything you told me. But when i try to validate my OUT document i receive. This is after i deleted the default template for Email delivery confirmation
RPC_ERROR


Odoo Server Error


Occured on buldent-testing-20328414.dev.odoo.com on model stock.picking and id 16 on 2025-05-21 13:21:46 GMT


Traceback (most recent call last):

  File "/home/odoo/src/odoo/odoo/http.py", line 1976, in _transactioning

    return service_model.retrying(func, env=self.env)

           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/home/odoo/src/odoo/odoo/service/model.py", line 156, in retrying

    result = func()

             ^^^^^^

  File "/home/odoo/src/odoo/odoo/http.py", line 1943, in _serve_ir_http

    response = self.dispatcher.dispatch(rule.endpoint, args)

               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/home/odoo/src/odoo/odoo/http.py", line 2191, in dispatch

    result = self.request.registry['ir.http']._dispatch(endpoint)

             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/home/odoo/src/odoo/odoo/addons/base/models/ir_http.py", line 333, in _dispatch

    result = endpoint(**request.params)

             ^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/home/odoo/src/odoo/odoo/http.py", line 740, in route_wrapper

    result = endpoint(self, *args, **params_ok)

             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/home/odoo/src/odoo/addons/web/controllers/dataset.py", line 42, in call_button

    action = call_kw(request.env[model], method, args, kwargs)

             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/home/odoo/src/odoo/odoo/api.py", line 533, in call_kw

    result = getattr(recs, name)(*args, **kwargs)

             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/home/odoo/src/odoo/addons/sale_project_stock/models/stock_picking.py", line 11, in button_validate

    res = super().button_validate()

          ^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/home/odoo/src/odoo/addons/stock/models/stock_picking.py", line 1428, in button_validate

    pickings_to_backorder.with_context(cancel_backorder=False)._action_done()

  File "/home/odoo/src/user/shipping_backbone_ns/models/stock_picking.py", line 19, in _action_done

    action_done = super(StockPicking, self)._action_done()

                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/home/odoo/src/odoo/addons/sale_stock/models/stock.py", line 120, in _action_done

    res = super()._action_done()

          ^^^^^^^^^^^^^^^^^^^^^^

  File "/home/odoo/src/enterprise/quality_control/models/stock_picking.py", line 86, in _action_done

    return super(StockPicking, self)._action_done()

           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/home/odoo/src/odoo/addons/mrp_subcontracting/models/stock_picking.py", line 54, in _action_done

    res = super(StockPicking, self)._action_done()

          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/home/odoo/src/odoo/addons/stock/models/stock_picking.py", line 1263, in _action_done

    self._send_confirmation_email()

  File "/home/odoo/src/odoo/addons/stock_delivery/models/stock_picking.py", line 100, in _send_confirmation_email

    return super(StockPicking, self)._send_confirmation_email()

           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/home/odoo/src/odoo/addons/stock_sms/models/stock_picking.py", line 49, in _send_confirmation_email

    super(Picking, self)._send_confirmation_email()

  File "/home/odoo/src/odoo/addons/stock/models/stock_picking.py", line 1270, in _send_confirmation_email

    stock_pick.with_context(force_send=True).message_post_with_source(

  File "/home/odoo/src/odoo/addons/mass_mailing/models/mail_thread.py", line 42, in message_post_with_source

    return super(MailThread, self.with_context(

           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/home/odoo/src/odoo/addons/mail/models/mail_thread.py", line 2562, in message_post_with_source

    template, view = self._get_source_from_ref(source_ref)

                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/home/odoo/src/odoo/addons/mail/models/mail_thread.py", line 3009, in _get_source_from_ref

    raise ValueError(

ValueError: Mailing or posting with a source should not be called with an empty template


The above server error caused the following client error:

RPC_ERROR: Odoo Server Error

    RPC_ERROR

        at makeErrorFromResponse (https://buldent-testing-20328414.dev.odoo.com/web/assets/380de69/web.assets_web.min.js:3143:163)

        at XMLHttpRequest.<anonymous> (https://buldent-testing-20328414.dev.odoo.com/web/assets/380de69/web.assets_web.min.js:3148:13)

Avatar
Discard
Best Answer

Hey guys i am on version 18 and i did everything you told me. But when i try to validate my OUT document i receive. This is after i deleted the default template for Email delivery confirmation
RPC_ERROR


Odoo Server Error


Occured on buldent-testing-20328414.dev.odoo.com on model stock.picking and id 16 on 2025-05-21 13:21:46 GMT


Traceback (most recent call last):

  File "/home/odoo/src/odoo/odoo/http.py", line 1976, in _transactioning

    return service_model.retrying(func, env=self.env)

           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/home/odoo/src/odoo/odoo/service/model.py", line 156, in retrying

    result = func()

             ^^^^^^

  File "/home/odoo/src/odoo/odoo/http.py", line 1943, in _serve_ir_http

    response = self.dispatcher.dispatch(rule.endpoint, args)

               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/home/odoo/src/odoo/odoo/http.py", line 2191, in dispatch

    result = self.request.registry['ir.http']._dispatch(endpoint)

             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/home/odoo/src/odoo/odoo/addons/base/models/ir_http.py", line 333, in _dispatch

    result = endpoint(**request.params)

             ^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/home/odoo/src/odoo/odoo/http.py", line 740, in route_wrapper

    result = endpoint(self, *args, **params_ok)

             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/home/odoo/src/odoo/addons/web/controllers/dataset.py", line 42, in call_button

    action = call_kw(request.env[model], method, args, kwargs)

             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/home/odoo/src/odoo/odoo/api.py", line 533, in call_kw

    result = getattr(recs, name)(*args, **kwargs)

             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/home/odoo/src/odoo/addons/sale_project_stock/models/stock_picking.py", line 11, in button_validate

    res = super().button_validate()

          ^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/home/odoo/src/odoo/addons/stock/models/stock_picking.py", line 1428, in button_validate

    pickings_to_backorder.with_context(cancel_backorder=False)._action_done()

  File "/home/odoo/src/user/shipping_backbone_ns/models/stock_picking.py", line 19, in _action_done

    action_done = super(StockPicking, self)._action_done()

                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/home/odoo/src/odoo/addons/sale_stock/models/stock.py", line 120, in _action_done

    res = super()._action_done()

          ^^^^^^^^^^^^^^^^^^^^^^

  File "/home/odoo/src/enterprise/quality_control/models/stock_picking.py", line 86, in _action_done

    return super(StockPicking, self)._action_done()

           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/home/odoo/src/odoo/addons/mrp_subcontracting/models/stock_picking.py", line 54, in _action_done

    res = super(StockPicking, self)._action_done()

          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/home/odoo/src/odoo/addons/stock/models/stock_picking.py", line 1263, in _action_done

    self._send_confirmation_email()

  File "/home/odoo/src/odoo/addons/stock_delivery/models/stock_picking.py", line 100, in _send_confirmation_email

    return super(StockPicking, self)._send_confirmation_email()

           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/home/odoo/src/odoo/addons/stock_sms/models/stock_picking.py", line 49, in _send_confirmation_email

    super(Picking, self)._send_confirmation_email()

  File "/home/odoo/src/odoo/addons/stock/models/stock_picking.py", line 1270, in _send_confirmation_email

    stock_pick.with_context(force_send=True).message_post_with_source(

  File "/home/odoo/src/odoo/addons/mass_mailing/models/mail_thread.py", line 42, in message_post_with_source

    return super(MailThread, self.with_context(

           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/home/odoo/src/odoo/addons/mail/models/mail_thread.py", line 2562, in message_post_with_source

    template, view = self._get_source_from_ref(source_ref)

                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/home/odoo/src/odoo/addons/mail/models/mail_thread.py", line 3009, in _get_source_from_ref

    raise ValueError(

ValueError: Mailing or posting with a source should not be called with an empty template


The above server error caused the following client error:

RPC_ERROR: Odoo Server Error

    RPC_ERROR

        at makeErrorFromResponse (https://buldent-testing-20328414.dev.odoo.com/web/assets/380de69/web.assets_web.min.js:3143:163)

        at XMLHttpRequest.<anonymous> (https://buldent-testing-20328414.dev.odoo.com/web/assets/380de69/web.assets_web.min.js:3148:13)

Avatar
Discard
Best Answer

Since you are using the sales module, check out the module "Club SO lines" by intelliversal integrated solutions. This module groups the products written under a section with marked checkbox and shows them as a single product to the customer in their invoice.

Avatar
Discard
Best Answer

Hi guys is there any way to set customer specific email templates in invoice while sending?

Odoo 15

thanks in advance


Avatar
Discard
Related Posts Replies Views Activity
1
May 21
2773
2
Sep 24
3223
0
Jul 24
1114
4
Oct 22
5452
2
Mar 22
4108