OdooWiki OCA HUB

Mail Template Domain

mail_template_domain folder_open OCA/mail open_in_new
Technical License: AGPL-3

This module allows setting an application domain on mail templates.

When a domain is configured on a template, that template will only appear in the email composer when the active record matches the domain. Templates without a domain continue to appear for all records of the applicable model.

auto_awesome What this module does

AI-generated from the code · Odoo 18.0

Lets you restrict a mail template so it only appears in the email composer when the record you are emailing matches a condition you define. Templates without a restriction keep showing for all records.

This module adds an optional restriction to email templates. On the template form, after the model field, you get a "Restrict to" checkbox and, when ticked, a domain builder where you define the condition a record must meet for the template to be offered.

When someone opens the email composer (for example from a quotation, invoice or any record), Odoo checks each template of that model. Templates with no restriction, or with an empty condition, are always offered. Templates with a condition are offered only if every record being emailed matches it. The template list in the composer is filtered accordingly, and the search limit is raised so all matching templates remain reachable.

Business rules and automatic behaviour: - Unticking "Restrict to" automatically resets the condition to empty. - Changing the template's model also resets the condition to empty. - The condition is stored on the template and evaluated live against the selected records.

It touches the email template model mail.template and the email composer mail.compose.message, and adds fields to the template form view.

Depends on

mail
Models and fields (2)
  • mail.template · extends an existing modelfilter_model (Restrict?), filter_domain (Restrict domain)
  • mail.compose.message · extends an existing modeltemplate_id, domain_template_id

Text generated by AI (DeepSeek) from reading the Odoo 18.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: 2 confirmed, 7 with no information of 9 versions.

terminal Installation and usage

OCA documentation · Odoo 18.0

To use this module:

  • Go to Settings > Technical > Email > Templates.
  • Open or create a mail template.
  • Select an option under Applies to (such as Contact).
  • Check the Restrict to checkbox, set the domain that records must match for this template to appear in the composer (e.g. [('is_company', '=', True)] to show the template only on contacts where Is a Company is set).
  • Leave Apply on empty to keep the template available for all records of the model (default behaviour).

When a user opens the email composer from a record, only templates whose Apply on domain matches that record will be listed in the Load template dropdown.

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.