Skip to main content
iVentureTeam

mailing_filter

A relation picker with two extra icons: save the current recipient domain as a favorite, or drop the one you loaded. On the Odoo 20 development branch the whole idea is replaced.

Siddharth JambukiyaSiddharth JambukiyaOdoo Techno-Functional Consultant
August 27, 2026Updated September 8, 20266 min read
Technical namemailing_filter
Field typesmany2one
Viewsform
Modulemass_mailing, the Email Marketing app
Used in core1 occurrence, the favorite filter on the mailing form in mass_mailing
VersionsOdoo 19.0, Odoo 18.0, Odoo 17.0, Odoo 16.0
No-code setupNo. It is tied to the mailing model's domain and model fields
Alternativesmany2one, domain, many2many_tags, field_selector

What the favorite filter picker does

A mailing's recipients are defined by a domain: customers in a country, contacts with a tag, leads above a value. Building one takes a few minutes, and the same audience is usually mailed more than once, so Odoo lets you save a domain as a named favorite and reload it later.

This widget is where that happens. It renders as a normal relation picker for the saved filter, with two small icons beside it. One saves the mailing's current domain as a new favorite, asking for a name in a small dropdown. The other removes the loaded favorite from the mailing.

The removal is the more considered of the two. Clearing the favorite does not clear the audience: the widget writes the filter's domain into the mailing's own domain field first, so the recipients stay exactly as they were and only the link to the favorite is dropped.

What this means for your team

Saved audiences are what turn email marketing from a series of one-offs into a repeatable programme. If rebuilding the recipient domain is a five minute job every time, people either skip segmentation or reuse a mailing by duplicating it, which drags old content along with the audience.

The behavior worth explaining to a marketing team is the removal semantics. Dropping a favorite keeps the audience, which is almost always what people mean; they want to stop tracking the favorite, not to mail everybody. If they genuinely want a different audience, the domain has to be edited afterwards.

The other thing to plan for is that this whole model changes in the next version. A single favorite per mailing becomes several dynamic lists, which is a better fit for how audiences are actually composed, and it means any process or training built around the current widget will need revisiting.

Supported options in Odoo 19

Two options are declared on top of the relation picker's own, both naming companion fields. Their defaults match the mailing model, so a view on that model can omit them. Read from mailing_m2o_filter.js and the relation picker, Odoo 19.0.

OptionTypeWhat it does
domain_fieldfieldNames the char field holding the recipient domain. Read when saving a new favorite, and written when removing one so the audience is preserved.(default: mailing_domain)
model_fieldfieldNames the field holding the target model. Read when saving a new favorite so the filter knows what it applies to.(default: mailing_model_id)
no_createbooleanInherited from the relation picker. Core sets it, because filters are created through the save icon rather than the dropdown.(default: false)
no_openbooleanInherited. Core sets it so the filter record cannot be opened from the field.(default: false)
search_thresholdnumberInherited from the relation picker. Minimum typed characters before the search runs.

Both options name fields the widget writes to, not just reads. Saving reads the domain field and the model field to build the new filter record; removing writes the filter's domain back into the domain field. On a model without those fields, the picker renders but neither action works.

Working examples

The core usage

<field name="mailing_filter_id" widget="mailing_filter"
       placeholder="Reload a favorite filter"
       options="{'no_create': 1, 'no_open': 1,
                  'domain_field': 'mailing_domain',
                  'model_field': 'mailing_model_id'}"
       readonly="state in ('sending', 'done')"/>

Creation and opening are disabled through inherited options, because filters are created through the save icon rather than the dropdown.

Relying on the defaults

<field name="mailing_filter_id" widget="mailing_filter"/>

Valid on the mailing model, whose domain and model fields match the defaults.

On another model

<field name="filter_id" widget="mailing_filter"
       options="{'domain_field': 'target_domain',
                  'model_field': 'target_model_id'}"/>

The source comment names marketing automation campaigns as the other intended model, which is why the field names are options rather than constants.

Why removing a favorite keeps your audience

Saving is a direct record creation rather than a form. The widget reads the name typed into the dropdown, refuses an empty one with a notification and keeps the dropdown open by stopping the event, then creates a filter record carrying that name, the mailing's current domain and its model, and finally selects the new record in the field.

Removing is the more interesting half. It writes two things in one update: the field itself to false, and the domain field to the domain that was on the loaded filter. That ordering is what preserves the audience. Without it, dropping the favorite would leave the mailing with whatever domain it had before, which after a reload is usually nothing.

The save icon's availability is recalculated after every render, based on whether a filter is set, whether the input was emptied, whether the domain has diverged from the saved one and whether the field is currently being edited. That logic is documented in a comment in the source, which is unusual and useful.

The implementation detail worth flagging is how it finds its own controls. The icon state is applied by looking up elements with document-wide queries rather than through component references, and the name input is read the same way. That works because there is one of these on a mailing form, and it would not if there were two, which puts this widget in the same small family as a couple of others in core that reach into the document.

One more thing: the class extends the base component rather than the relation picker component, and rebuilds the picker's props itself. That is why its declared props copy the relation picker's props explicitly instead of inheriting them.

Version compatibility

VersionStatusNotes
Odoo 20.0Not availableNot released. The widget and the single-favorite field are removed; the mailing form moves to a many-to-many of dynamic lists.
Odoo 19.0VerifiedVerified against the shipped source.
Odoo 18.0VerifiedSame two options and the same save and remove behavior.
Odoo 17.0VerifiedSame behavior with the older component conventions.
Odoo 16.0VerifiedSame behavior with the older component conventions.

Upgrade note. The two options and the behavior are stable from Odoo 16 through Odoo 19, so views carry over within that range. The change that needs planning is Odoo 20, where the widget and the single-favorite field both disappear. Any custom view or training material referring to a favorite filter will need rewriting.

What is changing in Odoo 20

Odoo 20 is expected at Odoo Experience in Brussels, 24 to 26 September 2026. The development branch is unstable and this may still change; we re-verify the page after release.

The widget is deleted. There is no registration under this name on the development branch and the JavaScript file is gone, although the underlying filter model survives.

The concept changes shape. The mailing form replaces the single favorite with a many-to-many of what it now calls dynamic lists, rendered with a mailing-specific tags widget, and shows a recipient count beside it. The recipient domain itself moves to a savable domain widget.

So this is not a rename to follow but a redesign: one saved filter per mailing becomes several, composed together. Custom code reading the single favorite field should be reviewed before upgrading.

Common problems and fixes

SymptomCause and fix
The save icon never appearsThe domain has not changed since the loaded favorite, so there is nothing new to save. Edit the recipient domain first; the icon state is recalculated after every render.
Saving does nothingThe name input was left empty, which is refused with a notification while the dropdown stays open. Type a name and save again.
Removing the favorite changed my recipientsThat is the opposite of the intended behavior, which writes the filter's domain back into the mailing. Check that the domain field option names the right field; without it the write cannot happen.
Saving creates a filter for the wrong modelThe model field option names a different field than the one the mailing uses. Set model_field to the field holding the target model.
Two of these on one screen misbehaveThe widget finds its controls with document-wide lookups. Use only one per screen.
The picker is read-onlyThe core view makes it read-only once the mailing is sending or done. Expected. A sent mailing's audience should not change.

Favorite filter picker vs the alternatives

WidgetBest forKey difference
mailing_filterSaving and reloading a mailing's recipient domain as a named favoriteA relation picker with inline save and remove actions that also write the mailing's own domain field
many2oneSelecting a saved filter without the save shortcutNo save or remove actions and no writing to the domain field
domainEditing the recipient domain itselfThe domain editor rather than a picker for saved ones
many2many_tagsComposing several saved audiencesThe direction Odoo 20 takes, several filters rather than one
field_selectorChoosing a field inside a domainA component of the domain editor, not an audience picker

On any other model, a plain relation picker plus a domain field does the same job without the save shortcut, and a domain widget with saving built in covers the recurring case. The part of this widget worth borrowing is the removal semantics: when you drop a saved selection, write its effect into the record rather than leaving the record empty.

Frequently asked questions

What happens when I remove a favorite filter?+
The field is cleared and, in the same update, the filter's domain is written into the mailing's own domain field. Your recipients stay exactly as they were; only the link to the favorite is dropped.
Why can I not save my filter?+
Either the name was left empty, which is refused with a notification, or the save icon is hidden because the domain has not changed since the loaded favorite.
Which fields does it need?+
Two, named by options with defaults matching the mailing model: the domain field and the model field. It reads both when saving and writes the domain field when removing.
Can I use it on another model?+
Yes, which is why the field names are options. The source names marketing automation campaigns as the other intended model.
What replaces it in Odoo 20?+
The single favorite becomes a many-to-many of dynamic lists on the mailing form, rendered with a mailing-specific tags widget, and the domain moves to a savable domain widget. The widget itself is removed.

Audiences you can reuse without duplicating a mailing

Segmentation, saved audiences and the data quality underneath them decide whether email marketing compounds or restarts every campaign. We set up Odoo Email Marketing and its data model on versions 16 through 19.

Book a free consultation

How this page was produced

The save and remove actions, the empty name handling, the icon state logic and the document-wide lookups were read from mailing_m2o_filter.js on the Odoo 19.0 branch, with the inherited option set read from the relation picker in web. The usage and its options come from mass_mailing/views/mailing_mailing_views.xml. The removal in Odoo 20 was verified by searching the public development branch for the registration and by reading the redesigned mailing form there. Spotted an error? Tell us and we will correct the page.