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.
| Technical name | EventMailTemplateReferenceField |
|---|---|
| Field types | reference, char |
| Views | form, list |
| Module | event |
| Used in core | 4 occurrences across 1 module: the event communication scheduler form and list views |
| Versions | Odoo 20.0, Odoo 19.0, Odoo 18.0 |
| No-code setup | No. Applied via the widget attribute in view XML |
| Alternatives | reference, many2one, selection |
What the Event template reference does
What this means for your team
Supported options in Odoo 19
| Option | Type | What it does |
|---|---|---|
hide_model | boolean | Inherited from the reference widget. Hides the model selector, leaving only the record picker. The preselected first model still applies underneath. |
model_field | field name | Inherited 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_create | boolean | Inherited 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
Selection order, readonly links, and the envelope
Version compatibility
| Version | Status | Notes |
|---|---|---|
| Odoo 20.0 | In development | Not released. File byte-identical on the development branch; we re-verify after launch. |
| Odoo 19.0 | Verified | Verified against the shipped source. |
| Odoo 18.0 | Verified | Widget introduced in this version, identical to 19.0. |
| Odoo 17.0 | Not available | Widget does not exist; template_ref rendered through generic widgets. |
| Odoo 16.0 | Not available | Widget 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
Common problems and fixes
| Symptom | Cause and fix |
|---|---|
| Widget not found in the console, field renders as default | The 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 list | By 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 template | The icon renders only when the relation is mail.template. No fix needed; only mail templates are marked. |
| The wrong model is preselected on new lines | The 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 picker | Quick-create is available unless disabled. Pass options="{'no_quick_create': True}" as core does. |
Event template reference vs the alternatives
| Widget | Best for | Key difference |
|---|---|---|
EventMailTemplateReferenceField | Template pickers on event communication lines | Preselects the first template model and marks mail templates |
reference | Generic model-plus-record pickers | Starts with an empty model selector and keeps readonly links |
| many2one | Links to one fixed model | No model selector at all; simpler when the target never varies |
| selection | Fixed lists that are not records | Static choices, no relation behind them |
Frequently asked questions
What does EventMailTemplateReferenceField do that the reference widget does not?+
Why is the widget name capitalized like that?+
Can I use this widget outside the events app?+
How does Odoo limit the picker to event templates?+
Does the widget work on char fields?+
Is this widget changing in Odoo 20?+
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