Skip to main content
iVentureTeam

EventMailTemplateReferenceField

The template picker on Odoo's event communication lines is a tuned reference widget: EventMailTemplateReferenceField preselects the first template model, marks mail templates with an envelope, and refuses to open records from readonly rows.

Siddharth JambukiyaSiddharth JambukiyaOdoo Techno-Functional Consultant
August 21, 2026Updated August 21, 20266 min read
Technical nameEventMailTemplateReferenceField
Field typesreference, char
Viewsform, list
Moduleevent
Used in core4 occurrences across 1 module: the event communication scheduler form and list views
VersionsOdoo 20.0, Odoo 19.0, Odoo 18.0
No-code setupNo. Applied via the widget attribute in view XML
Alternativesreference, many2one, selection

What the Event template reference does

Event communication lines in Odoo let an organizer schedule mails or SMS around an event: a reminder three days before, a follow-up after. Each line stores which template to send in template_ref, a reference field that can point at a mail template, an SMS template, or whatever other template models are installed. This widget renders that field.

A reference widget is really two controls in one: a model selector and a record picker. The stock version starts with the model selector empty, which is one click of friction on every new line and a source of half-filled rows. The event variant's entire setup override is choosing a default: it reads the field's selection list and preselects the first model, so a new communication line starts on Mail Template and the user goes straight to picking which template.

Beyond that it makes two presentation calls: an envelope icon appears beside the value when the chosen model is mail.template, and in readonly contexts the many2one refuses to open the template, so a list of scheduler lines reads as text instead of a row of internal links.

What this means for your team

Event communication is one of the highest-leverage automations in Odoo events: registration confirmations, reminders, and post-event follow-ups run themselves once the schedule is right. The template picker is where that setup succeeds or silently fails, because a scheduler line without a template does nothing.

The widget's small defaults matter operationally. Preselecting the mail model means the common case, an email reminder, is two clicks: pick template, set trigger. The readonly no-open rule matters for the people reviewing rather than editing: an events manager scanning the communication list of twenty events is not accidentally navigated into template forms mid-review.

The part the widget does not solve is template hygiene. The picker shows whatever templates the filter context allows, and core scopes it to event-appropriate templates with filter_template_on_event. If your team clones templates per event, the list grows until picking the right one is the slow step. A naming convention, or a custom filter mirroring core's context trick, keeps the picker useful at scale.

Supported options in Odoo 19

Verified against field_event_mail_template_reference.js in the Odoo 19.0 event module and the base reference_field.js it extends. The variant declares no options of its own; everything below is inherited from the reference widget, which itself passes many2one options through.

OptionTypeWhat it does
hide_modelbooleanInherited from the reference widget. Hides the model selector, leaving only the record picker. The preselected first model still applies underneath.
model_fieldfield nameInherited from the reference widget. Points at a many2one to ir.model on the same record that decides the target model; must reference ir.model or the widget throws. Also hides the model selector.
no_quick_createbooleanInherited through the many2one prop pipeline. Removes creating a template from typed text; core sets it on every usage of this widget.

The inherited many2one family applies too. Core's own usage passes no_quick_create to keep users from creating templates from typed text. Options like no_create and no_open behave as they do on any many2one, alongside the two reference-specific options in the table.

Working examples

As core uses it on scheduler lines

<field name="template_ref"
       widget="EventMailTemplateReferenceField"
       options="{'no_quick_create': True}"
       context="{'filter_template_on_event': True, 'default_model': 'event.registration'}"/>

The context keys do the template scoping server-side; the option removes inline creation. Note the exact CamelCase widget name.

Hiding the model selector entirely

<field name="template_ref"
       widget="EventMailTemplateReferenceField"
       options="{'hide_model': True}"/>

Useful when only one template model is installed anyway; the preselected first model then does all the work and users see a single picker.

Selection order, readonly links, and the envelope

Three source details are worth pinning down.

The default model is positional, not named. The setup override takes this.selection?.[0][0], the first entry of the field's selection, whatever it is. On a stock database that is the mail template model, but the selection is built server-side from installed template models, so installing a module that reorders or prepends to that selection changes the default silently. If a customization depends on "mail is the default", it is depending on selection order.

Readonly kills opening, deliberately. The m2oProps getter checks props.readonly and forces canOpen = false, with a source comment explaining that m2o values in list views are expected to read as plain strings. This is the opposite default from the base many2one, where readonly values render as links.

The envelope is a template inheritance, not component logic. The widget's XML inherits the base reference template and injects an icon block rendered only when relation === 'mail.template'. There is no icon mapping to configure; other models simply get nothing, so an SMS line is distinguished by its model name, not an icon.

Version compatibility

VersionStatusNotes
Odoo 20.0In developmentNot released. File byte-identical on the development branch; we re-verify after launch.
Odoo 19.0VerifiedVerified against the shipped source.
Odoo 18.0VerifiedWidget introduced in this version, identical to 19.0.
Odoo 17.0Not availableWidget does not exist; template_ref rendered through generic widgets.
Odoo 16.0Not availableWidget does not exist.

Upgrade note. The widget appears in Odoo 18; 16 and 17 rendered template_ref with generic widgets. The 18 and 19 files are identical, so views carry over untouched. Remember the CamelCase name when porting hand-written XML.

What is changing in Odoo 20

Odoo 20 is expected at Odoo Experience in Brussels, 24 to 26 September 2026. These notes come from the public development branch, which is unstable until feature freeze; we re-verify this page against the shipped release.

The widget's file is byte-identical on master: same setup override, same readonly rule, same registration. The base reference widget it extends shows only Odoo's framework-wide props-validation migration, with the hide_model and model_field options intact. Barring late changes, this page should apply to Odoo 20 as written, and we will confirm that after release.

Common problems and fixes

SymptomCause and fix
Widget not found in the console, field renders as defaultThe registry name is CamelCase and the XML attribute must match exactly. Write widget="EventMailTemplateReferenceField", not a lowercase variant.
Template shows as plain text instead of a link in the listBy design: readonly mode forces canOpen off in this variant. Open the scheduler line's form to navigate to the template.
No envelope icon next to an SMS templateThe icon renders only when the relation is mail.template. No fix needed; only mail templates are marked.
The wrong model is preselected on new linesThe default is the first entry of the field's selection, which another module can reorder. Check which modules extend the template_ref selection and their ordering.
Users create junk templates from the pickerQuick-create is available unless disabled. Pass options="{'no_quick_create': True}" as core does.

Event template reference vs the alternatives

WidgetBest forKey difference
EventMailTemplateReferenceFieldTemplate pickers on event communication linesPreselects the first template model and marks mail templates
referenceGeneric model-plus-record pickersStarts with an empty model selector and keeps readonly links
many2oneLinks to one fixed modelNo model selector at all; simpler when the target never varies
selectionFixed lists that are not recordsStatic choices, no relation behind them

Reach for this widget when a reference field mixes template models and mail is the sensible default. For single-model links, a plain many2one with a domain is simpler than a reference field.

Frequently asked questions

What does EventMailTemplateReferenceField do that the reference widget does not?+
Three things: it preselects the first model of the selection so new lines start on Mail Template, it disables opening the linked record in readonly mode, and it shows an envelope icon when the chosen model is mail.template. Options and everything else are inherited.
Why is the widget name capitalized like that?+
It is registered in the fields registry under the literal string EventMailTemplateReferenceField, one of the few CamelCase names in core alongside the CopyClipboard family. Registry lookups are case-sensitive, so XML must match exactly.
Can I use this widget outside the events app?+
Technically yes on any reference or char field once the event module is installed, but its assumptions, first-model default and a mail.template icon, are tuned for template selection. For other reference fields the base widget with hide_model or model_field is usually the better fit.
How does Odoo limit the picker to event templates?+
Not in the widget. Core passes context="{'filter_template_on_event': True}" on the field, and the template models apply that filter server-side in their search. The widget just displays whatever comes back.
Does the widget work on char fields?+
Yes, inherited from the base reference widget, which supports reference and char types. On a char field storing "model,id" pairs it fetches display names itself. Core only uses it on the real reference field template_ref.
Is this widget changing in Odoo 20?+
The development branch shows the file byte-identical to 19.0, and the base reference widget only picks up framework-level changes. Nothing is final until the September 2026 release, and we re-verify the page then.

Event comms firing late, twice, or never?

Scheduler lines, template scoping, and per-event sender rules are where Odoo event automation gets fiddly. We set up and extend event communication flows, custom templates, triggers, and reporting included, on Odoo 16 through 19.

Book a free consultation

How this page was produced

This page was verified by reading field_event_mail_template_reference.js and its XML template on the Odoo 19.0 branch, together with the base reference_field.js for the inherited options, and diffing all of them against 16.0, 17.0, 18.0, and master. Core usage was confirmed in event_mail_views.xml. The screenshot was captured on a clean Odoo 19 database. Report corrections via our contact page.