radio_selection_with_filter
Radio buttons that show only the choices this record is actually allowed to make. Small idea, and in Odoo 19 it changed contract in a way that silently breaks Odoo 18 views.
| Technical name | radio_selection_with_filter |
|---|---|
| Field types | selection |
| Views | form |
| Module | survey, though nothing in the widget is survey-specific |
| Used in core | 1 occurrence, the survey type selector in survey |
| Versions | Odoo 20.0, Odoo 19.0, Odoo 18.0 |
| No-code setup | No. Studio can set a Radio widget but cannot pass the allowed_selection_field option |
| Alternatives | radio, selection, selection_badge_icons, image_radio |
What the filtered radio field does
What this means for your team
Supported options in Odoo 19
| Option | Type | What it does |
|---|---|---|
allowed_selection_field | string (field name) | Technical name of the field holding the permitted selection keys. Read live from the record on every render, so a computed field makes the radio list reactive. Required: there is no unfiltered fallback.(since Odoo 19.0) |
horizontal | boolean | Inherited from the radio widget. Lays the radios out in a row instead of a column. Core passes it in the survey form.(default: false) |
The field named by allowed_selection_field must be loaded in the view, and it must contain something with an includes method, which in practice means a list of selection keys. The prop is declared as required, so omitting the option is a props error rather than a silent pass-through, and the filter itself would fail as soon as it tried to read a field with no name.
Working examples
The Odoo 18 to 19 contract change
Version compatibility
| Version | Status | Notes |
|---|---|---|
| Odoo 20.0 | Partial / changed | Not released. The widget survives, but core drops its only usage in favor of the badge-style selection widget. |
| Odoo 19.0 | Verified | Verified against the shipped source. The allow-list is read from a field named by allowed_selection_field. |
| Odoo 18.0 | Partial / changed | First version, different contract: the allow-list was a fixed array in the context key allowed_selection. |
| Odoo 17.0 | Not available | Widget does not exist. |
| Odoo 16.0 | Not available | Widget does not exist. |
Upgrade note. This is the one widget in this group that genuinely needs an XML edit on upgrade. Search inherited views for radio_selection_with_filter and convert any context="{'allowed_selection': [...]}" into options="{'allowed_selection_field': 'some_field'}", adding that field to the model if it does not exist. A computed non-stored selection-key list is the usual shape.
What is changing in Odoo 20
Common problems and fixes
| Symptom | Cause and fix |
|---|---|
| The form breaks after upgrading from Odoo 18 | The Odoo 18 context key allowed_selection is no longer read, so the required option is missing. Replace the context with options="{'allowed_selection_field': 'your_field'}" and load that field in the view. |
| No radio buttons at all | The allow-list field is empty or not loaded in the view. Add the field invisibly and confirm it returns a non-empty list of selection keys. |
| An error about includes not being a function | The named field holds something other than a list, for example a char or a boolean. Make the field return a list of selection keys, typically a computed non-stored field. |
| The widget refuses a many2one field | This widget narrows supportedTypes to selection only, unlike the base radio widget. Use the plain radio widget for many2one fields. |
| horizontal is ignored | Usually a typo, since the option is inherited and does work here. Check the options dictionary syntax; the value must be True, not a string. |
| A previously chosen value vanished from the radios | The allow-list no longer contains it, and the filter removes it from the rendered list. Expected. Show the stored value elsewhere if users need to see what they had. |
Filtered radio field vs the alternatives
| Widget | Best for | Key difference |
|---|---|---|
radio_selection_with_filter | Selection fields where the legal choices depend on the record | Filters the radio list against a live allow-list field instead of showing every declared value |
| radio | A short list of choices, all always available | No filtering, and it supports many2one fields as well as selection |
| selection | Longer choice lists in a dropdown | Dropdown rendering, no per-record filtering |
| selection_badge_icons | Choices shown as icon badges | Icon-driven presentation for many2one fields, no allow-list filtering |
image_radio | Choices that are best recognized visually | Renders images instead of labels, again with no filtering |
Frequently asked questions
How does radio_selection_with_filter decide which choices to show?+
What changed between Odoo 18 and Odoo 19?+
Can I use it on a many2one field?+
Does the horizontal option work?+
Is it going away in Odoo 20?+
Users choosing options your process cannot honor?
Rules that live only in a validation message are rules people learn by failing. We rebuild those constraints into the interface itself, filtered choices, honest defaults and clear reasons, as part of Odoo customization on 16 through 19.
Book a free consultation