OdooWiki OCA HUB

Mail Layout Force

mail_layout_force folder_open OCA/mail open_in_new
Marketing License: AGPL-3

Odoo will add a default email layout on most commercial communications.

The email layout is a QWeb view that ends up wrapping the message body when sending an email. It usually displays the related document reference, the company logo, and a small footer saying "Powered by Odoo".

There are notably three main layouts used in Odoo, and the user can't control when they're used, as it's hardcoded into the different applications.

  • mail.mail_notification_layout
  • mail.mail_notification_layout_with_responsible_signature
  • mail.mail_notification_light

This module allows to force a specific layout for a given email.template, effectively overwriting the one hardcoded by Odoo. Additionally, it enables forcing a custom layout for emails that do not use an existing email.template record (e.g., when sending an email from the chatter).

This allows you to fully customize the way Odoo emails are rendered and sent to your customers.

auto_awesome What this module does

AI-generated from the code · Odoo 18.0

Force a specific email layout on selected email templates or on all emails sent for chosen models, replacing the layout Odoo normally picks automatically.

Odoo wraps most notification emails in a standard layout (company logo, document reference, footer). This module lets you decide which layout is used instead of leaving that choice to Odoo.

  • On an email template (mail.template) you get a new "Force Layout" field where you pick the layout to use. Setting it updates the template's layout reference; clearing it removes the forced layout.
  • On a QWeb view form you get a new "Layout Mapping" tab (only visible for QWeb views). There you list replacement rules: for each rule you choose a target layout and, optionally, the models it applies to. If no models are selected, the rule applies to all models.
  • When Odoo prepares a notification email, it looks up the layout that would normally be used, then checks these rules. If a matching rule exists (for the specific model, or a rule with no model restriction), the replacement layout is used instead.
  • A ready-made "No-Layout" template is provided, which simply outputs the message body without any wrapper, so you can send emails with no layout at all.
  • When composing a message from a template, the composer picks up the template's forced layout automatically.

Access is read-only for regular users and full for system administrators. The module touches mail.template, mail.compose.message, mail.thread, ir.ui.view and adds the new email.layout.mapping model.

Depends on

mail
Models and fields (4)
  • ir.ui.view · extends an existing modellayout_mapping_line_ids
  • mail.template · extends an existing modelforce_email_layout_id (Force Layout)
  • email.layout.mapping · new modellayout_id, model_ids (Models), substitute_layout_id
  • mail.compose.message · extends an existing model

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: 5 confirmed, 4 with no information of 9 versions.

terminal Installation and usage

OCA documentation · Odoo 18.0

To configure a forced layout for email templates:

  • Go to Settings > Technical > Email > Email Templates
  • Open the desired email.template record
  • In the Settings tab, find the Force Layout field

You can leave it empty to use the default email layout (chosen by Odoo). You can force a custom email layout of your own. You can use the Mail: No-Layout notification template to prevent Odoo from adding a layout.

To configure a custom layout of your own, some technical knowledge is needed. You can see how the existing layouts are defined for details or inspiration:

  • mail.mail_notification_layout
  • mail.mail_notification_layout_with_responsible_signature
  • mail.mail_notification_light

To force a custom layout for emails that do not use an existing email.template record (e.g., emails sent from the chatter) or for cases where emails are sent directly via message_post without opening the mail composer (e.g., invoice send actions like action_invoice_sent), you can use the Layout Mapping feature:

  • Go to Settings > Technical > User Interface > Views
  • Copy the current layout (e.g., mail.mail_notification_layout_with_responsible_signature) to create a new custom layout, and customize it as needed
  • Open the original layout view that you want to replace. Under the Layout Mapping tab:
  • Click Add a line
  • Set Substitute Layout to the new custom layout you created
  • Set Models if you want to apply the replacement only to specific models. If left empty, the email layout will be replaced for all models

No verified information in OCA: Installation, Usage.

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.