Mail Layout Force

mail_layout_force
REPOSITORY
REPOSITORYOCA/mail
GIT
GIThttps://github.com/OCA/mail.git
GIT FOLDER
GIT FOLDERhttps://github.com/OCA/mail/tree/18.0/mail_layout_force
VERSION
VERSION 1.0.0
CATEGORY
CATEGORYMarketing
LICENSE
LICENSEAGPL-3
APPLICATION
APPLICATIONNo
AUTO-INSTALLABLE
AUTO-INSTALLABLENo
AUTHORS
AUTHORSOdoo Community Association (OCA), Camptocamp
MAINTAINERS
MAINTAINERSOdoo Community Association (OCA), Camptocamp
COMMITTERS
COMMITTERSOCA-git-bot, oca-ci, Aungkokolin1997
WEBSITE
WEBSITEhttps://github.com/OCA/mail
LAST TRACKING UPDATE
LAST TRACKING UPDATE2026-07-06 19:30:18
ODOO DEPENDENCIES
ODOO DEPENDENCIES odoo/odoo:
    - mail
    - base
    - base_setup
    - web
    - bus
    - web_tour
    - html_editor
PYTHON DEPENDENCIES
PYTHON DEPENDENCIES Not have
SYSTEM DEPENDENCIES
SYSTEM DEPENDENCIES Not have
DESCRIPTION
DESCRIPTION
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.

Code Analysis

Views touched (4)
XML IDNameModelTypeStatus
email_template_form mail.template field Inherits mail.email_template_form
mail_layout_custom mail_layout_custom ir.ui.view qweb New
mail_layout_noop Mail: No-Layout notification template ir.ui.view qweb New
view_ir_ui_view_form_inherit ir.ui.view.form.inherit ir.ui.view xpath Inherits base.view_view_form
Models touched (5)

New fields (3)
  • layout_id Many2one → ir.ui.view
    ondelete='cascade' args: 'ir.ui.view'
  • model_ids Many2many → ir.model
    help='Select models that the swapping applies to.' string='Models' args: 'ir.model'
  • substitute_layout_id Many2one → ir.ui.view
    domain=[('type', '=', 'qweb')] help='Select a target layout.' required=True args: 'ir.ui.view'
Public methods (0)

No public methods.

New fields (1)
  • layout_mapping_line_ids One2many → email.layout.mapping
    args: 'email.layout.mapping', 'layout_id'
Public methods (0)

No public methods.

New fields (0)

No new fields.

Public methods (1)
  • default_get(self, fields_list)
    @api.model

New fields (1)
  • force_email_layout_id Many2one → ir.ui.view
    comodel_name='ir.ui.view' compute='_compute_force_email_layout_id' domain=[('type', '=', 'qweb'), ('mode', '=', 'primary')] help='Force a mail layout for this template.' inverse='_inverse_force_email_layout_id' string='Force Layout'
Public methods (0)

No public methods.

New fields (0)

No new fields.

Public methods (0)

No public methods.

REPOSITORY
REPOSITORYOCA/social
GIT
GIThttps://github.com/OCA/social.git
GIT FOLDER
GIT FOLDERhttps://github.com/OCA/social/tree/17.0/mail_layout_force
VERSION
VERSION 1.0.1
CATEGORY
CATEGORYMarketing
LICENSE
LICENSEAGPL-3
APPLICATION
APPLICATIONNo
AUTO-INSTALLABLE
AUTO-INSTALLABLENo
AUTHORS
AUTHORSOdoo Community Association (OCA), Camptocamp
MAINTAINERS
MAINTAINERSOdoo Community Association (OCA), Camptocamp
COMMITTERS
COMMITTERSOCA-git-bot, sergio, oca-ci
WEBSITE
WEBSITEhttps://github.com/OCA/social
LAST TRACKING UPDATE
LAST TRACKING UPDATE2026-07-06 19:20:08
ODOO DEPENDENCIES
ODOO DEPENDENCIES odoo/odoo:
    - mail
    - base
    - base_setup
    - web
    - bus
    - web_tour
PYTHON DEPENDENCIES
PYTHON DEPENDENCIES Not have
SYSTEM DEPENDENCIES
SYSTEM DEPENDENCIES Not have
DESCRIPTION
DESCRIPTION
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 two main layouts used in Odoo, and the user can't control when
they're used, as it's hardcoded into the different applications.

* ``mail.message_notification_email``
* ``mail.mail_notification_light``
* ``mail.mail_notification_paynow``

This module allows to force a specific layout for a given ``email.template``,
effectively overwritting 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.

Code Analysis

Views touched (4)
XML IDNameModelTypeStatus
email_template_form mail.template field Inherits mail.email_template_form
mail_layout_custom mail_layout_custom ir.ui.view qweb New
mail_layout_noop Mail: No-Layout notification template ir.ui.view qweb New
view_ir_ui_view_form_inherit ir.ui.view.form.inherit ir.ui.view xpath Inherits base.view_view_form
Models touched (4)

New fields (3)
  • layout_id Many2one → ir.ui.view
    ondelete='cascade' args: 'ir.ui.view'
  • model_ids Many2many → ir.model
    help='Select models that the swapping applies to.' string='Models' args: 'ir.model'
  • substitute_layout_id Many2one → ir.ui.view
    domain=[('type', '=', 'qweb')] help='Select a target layout.' required=True args: 'ir.ui.view'
Public methods (0)

No public methods.

New fields (1)
  • layout_mapping_line_ids One2many → email.layout.mapping
    args: 'email.layout.mapping', 'layout_id'
Public methods (0)

No public methods.

New fields (1)
  • force_email_layout_id Many2one → ir.ui.view
    comodel_name='ir.ui.view' compute='_compute_force_email_layout_id' domain=[('type', '=', 'qweb'), ('mode', '=', 'primary')] help='Force a mail layout for this template.' inverse='_inverse_force_email_layout_id' string='Force Layout'
Public methods (0)

No public methods.

New fields (0)

No new fields.

Public methods (0)

No public methods.

REPOSITORY
REPOSITORYOCA/social
GIT
GIThttps://github.com/OCA/social.git
GIT FOLDER
GIT FOLDERhttps://github.com/OCA/social/tree/16.0/mail_layout_force
VERSION
VERSION 2.0.0
CATEGORY
CATEGORYMarketing
LICENSE
LICENSEAGPL-3
APPLICATION
APPLICATIONNo
AUTO-INSTALLABLE
AUTO-INSTALLABLENo
AUTHORS
AUTHORSOdoo Community Association (OCA), Camptocamp
MAINTAINERS
MAINTAINERSOdoo Community Association (OCA), Camptocamp
COMMITTERS
COMMITTERSWeblate, OCA-git-bot, oca-ci, Aungkokolin1997
WEBSITE
WEBSITEhttps://github.com/OCA/social
LAST TRACKING UPDATE
LAST TRACKING UPDATE2026-07-06 00:53:55
ODOO DEPENDENCIES
ODOO DEPENDENCIES odoo/odoo:
    - mail
    - base
    - base_setup
    - web
    - bus
    - web_tour
PYTHON DEPENDENCIES
PYTHON DEPENDENCIES Not have
SYSTEM DEPENDENCIES
SYSTEM DEPENDENCIES Not have
DESCRIPTION
DESCRIPTION

Code Analysis

Views touched (4)
XML IDNameModelTypeStatus
email_template_form mail.template field Inherits mail.email_template_form
mail_layout_custom mail_layout_custom ir.ui.view qweb New
mail_layout_noop Mail: No-Layout notification template ir.ui.view qweb New
view_ir_ui_view_form_inherit ir.ui.view.form.inherit ir.ui.view xpath Inherits base.view_view_form
Models touched (5)

New fields (3)
  • layout_id Many2one → ir.ui.view
    ondelete='cascade' args: 'ir.ui.view'
  • model_ids Many2many → ir.model
    help='Select models that the swapping applies to.' string='Models' args: 'ir.model'
  • substitute_layout_id Many2one → ir.ui.view
    domain=[('type', '=', 'qweb')] help='Select a target layout.' required=True args: 'ir.ui.view'
Public methods (0)

No public methods.

New fields (1)
  • layout_mapping_line_ids One2many → email.layout.mapping
    args: 'email.layout.mapping', 'layout_id'
Public methods (0)

No public methods.

New fields (0)

No new fields.

Public methods (0)

No public methods.

New fields (1)
  • force_email_layout_id Many2one → ir.ui.view
    comodel_name='ir.ui.view' context={'default_type': 'qweb'} domain=[('type', '=', 'qweb'), ('mode', '=', 'primary')] help='Force a mail layout for this template.' string='Force Layout'
Public methods (2)
  • create(self, vals_list)
    @api.model_create_multi
  • write(self, vals)

New fields (0)

No new fields.

Public methods (1)
  • message_post_with_template(self, template_id, email_layout_xmlid=None, **kwargs)
REPOSITORY
REPOSITORYOCA/social
GIT
GIThttps://github.com/OCA/social.git
GIT FOLDER
GIT FOLDERhttps://github.com/OCA/social/tree/15.0/mail_layout_force
VERSION
VERSION 2.0.1
CATEGORY
CATEGORYMarketing
LICENSE
LICENSEAGPL-3
APPLICATION
APPLICATIONNo
AUTO-INSTALLABLE
AUTO-INSTALLABLENo
AUTHORS
AUTHORSOdoo Community Association (OCA), Camptocamp
MAINTAINERS
MAINTAINERSOdoo Community Association (OCA), Camptocamp
COMMITTERS
COMMITTERSYoshi Tashiro, OCA-git-bot, oca-ci, Aungkokolin1997
WEBSITE
WEBSITEhttps://github.com/OCA/social
LAST TRACKING UPDATE
LAST TRACKING UPDATE2026-07-06 00:46:40
ODOO DEPENDENCIES
ODOO DEPENDENCIES odoo/odoo:
    - mail
    - base
    - base_setup
    - web
    - bus
    - web_tour
PYTHON DEPENDENCIES
PYTHON DEPENDENCIES Not have
SYSTEM DEPENDENCIES
SYSTEM DEPENDENCIES Not have
DESCRIPTION
DESCRIPTION

Code Analysis

Views touched (4)
XML IDNameModelTypeStatus
email_template_form mail.template field Inherits mail.email_template_form
mail_layout_custom mail_layout_custom ir.ui.view qweb New
mail_layout_noop Mail: No-Layout notification template ir.ui.view qweb New
view_ir_ui_view_form_inherit ir.ui.view.form.inherit ir.ui.view xpath Inherits base.view_view_form
Models touched (5)

New fields (3)
  • layout_id Many2one → ir.ui.view
    ondelete='cascade' args: 'ir.ui.view'
  • model_ids Many2many → ir.model
    help='Select models that the swapping applies to.' string='Models' args: 'ir.model'
  • substitute_layout_id Many2one → ir.ui.view
    domain=[('type', '=', 'qweb')] help='Select a target layout.' required=True args: 'ir.ui.view'
Public methods (0)

No public methods.

New fields (1)
  • layout_mapping_line_ids One2many → email.layout.mapping
    args: 'email.layout.mapping', 'layout_id'
Public methods (0)

No public methods.

New fields (0)

No new fields.

Public methods (0)

No public methods.

New fields (1)
  • force_email_layout_id Many2one → ir.ui.view
    comodel_name='ir.ui.view' context={'default_type': 'qweb'} domain=[('type', '=', 'qweb'), ('mode', '=', 'primary')] help='Force a mail layout for this template.' string='Force Layout'
Public methods (2)
  • create(self, vals_list)
    @api.model_create_multi
  • write(self, vals)

New fields (0)

No new fields.

Public methods (1)
  • message_post_with_template(self, template_id, email_layout_xmlid=None, **kwargs)
REPOSITORY
REPOSITORYOCA/social
GIT
GIThttps://github.com/OCA/social.git
GIT FOLDER
GIT FOLDERhttps://github.com/OCA/social/tree/14.0/mail_layout_force
VERSION
VERSION 1.0.0
CATEGORY
CATEGORYMarketing
LICENSE
LICENSEAGPL-3
APPLICATION
APPLICATIONNo
AUTO-INSTALLABLE
AUTO-INSTALLABLENo
AUTHORS
AUTHORSOdoo Community Association (OCA), Camptocamp
MAINTAINERS
MAINTAINERSOdoo Community Association (OCA), Camptocamp
COMMITTERS
COMMITTERSIvàn Todorovich, oca-travis, Weblate, OCA-git-bot
WEBSITE
WEBSITEhttps://github.com/OCA/social
LAST TRACKING UPDATE
LAST TRACKING UPDATE2026-07-06 00:41:08
ODOO DEPENDENCIES
ODOO DEPENDENCIES odoo/odoo:
    - mail
    - base
    - base_setup
    - web
    - bus
    - web_tour
PYTHON DEPENDENCIES
PYTHON DEPENDENCIES Not have
SYSTEM DEPENDENCIES
SYSTEM DEPENDENCIES Not have
DESCRIPTION
DESCRIPTION

Code Analysis

Views touched (3)
XML IDNameModelTypeStatus
email_template_form mail.template field Inherits mail.email_template_form
mail_layout_custom mail_layout_custom ir.ui.view qweb New
mail_layout_noop Mail: No-Layout notification template ir.ui.view qweb New
Models touched (3)

New fields (0)

No new fields.

Public methods (1)
  • send_mail(self, auto_commit=False)

New fields (1)
  • force_email_layout_id Many2one → ir.ui.view
    comodel_name='ir.ui.view' context={'default_type': 'qweb'} domain=[('type', '=', 'qweb'), ('mode', '=', 'primary')] help='Force a mail layout for this template.' string='Force Layout'
Public methods (2)
  • create(self, vals_list)
    @api.model_create_multi
  • write(self, vals)

New fields (0)

No new fields.

Public methods (1)
  • message_post_with_template(self, template_id, email_layout_xmlid=None, **kwargs)