OdooWiki OCA HUB

Mail Template Substitute

mail_template_substitute folder_open OCA/mail open_in_new
Uncategorised License: AGPL-3

This module allows you to create substitution rules for mail templates. A typical use case is to replace a standard template by alternative templates when some conditions are met. For instance, it allows to configure alternate templates for different companies.

auto_awesome What this module does

AI-generated from the code · Odoo 19.0

Lets you attach substitution rules to an email template so that, when the selected records match a condition, a different template is used automatically. Useful for sending alternate templates per company or per record type.

This module adds a way to swap one email template for another depending on which records are being emailed.

On each email template (the standard template form) a new "Substitution Rules" tab appears. There you add rules, each with: - an order (sequence) to decide which rule is checked first, - the replacement template to use (it must target the same kind of record), - a condition (domain) describing which records trigger the swap.

When Odoo prepares an email from a template, it checks the rules in order. If all the selected records match a rule's condition, the replacement template is used instead of the original one. If no rule matches, the original template is used as usual.

This applies both when composing a message from the mail composer and when sending invoices or other accounting documents through the send wizard, where the template field is filled in automatically with the substitute.

The rules are stored in a dedicated model, mail.template.substitution.rule, linked to mail.template. The behaviour is wired into mail.compose.message and account.move.send.wizard. All internal users can read, create, edit and delete substitution rules.

Depends on

basemailaccount

Required by other modules

Models and fields (4)
  • mail.template · extends an existing modelmail_template_substitution_rule_ids (Substitution Rules)
  • mail.compose.message · extends an existing model
  • account.move.send.wizard · extends an existing model
  • mail.template.substitution.rule · new modelmodel, domain, sequence, mail_template_id, substitution_mail_template_id

Text generated by AI (DeepSeek) from reading the Odoo 19.0 code on GitHub; it may contain mistakes, so check the code before deciding. View the code on GitHub

Availability by version

Reviewed: 2026-11-03
Confirmed (verified in repository and branch) Estimated (unverified) No information

Confirmation status: 5 confirmed, 4 with no information of 9 versions.

terminal Installation and usage

OCA documentation · Odoo 19.0

To use this module, you need to:

  • Go to 'Email' / 'Templates'
  • Select the desired template you want to substitute
  • In the substitutions page add a new line
  • Select the substitution template
  • Set a domain to specify when this substitution should happen

No verified information in OCA: Installation, Configuration.

info

Data imported from GitHub: this sheet reflects the latest catalog review, not a live lookup. Always check the module documentation and staging before installing in production.