boolean_radio
New in Odoo 19: boolean_radio shows a boolean as two radio buttons whose labels are full translatable sentences harvested from elements in the same view. Skip either option and the widget refuses to mount.
| Technical name | boolean_radio |
|---|---|
| Field types | boolean |
| Views | form |
| Module | hr (Employees) |
| Used in core | 2 occurrences across 2 modules: hr_holidays, hr_attendance |
| Versions | Odoo 20.0, Odoo 19.0 |
| No-code setup | No. Applied in view XML together with the two label elements |
| Alternatives | radio, boolean, boolean_toggle |
What the boolean radio field does
What this means for your team
Supported options in Odoo 19
| Option | Type | What it does |
|---|---|---|
yes_label_element_id | string (required) | DOM id of the element whose innerText becomes the label of the True radio. Required prop: omitting it throws a props validation error and the field does not render.(since Odoo 19.0) |
no_label_element_id | string (required) | DOM id of the element labeling the False radio. Same contract: required, resolved once at mount, must be present in the DOM at that moment.(since Odoo 19.0) |
The ids must exist in the DOM when the widget mounts. The lookup is a plain document.getElementById at mount time: an element inside a collapsed notebook page or a lazily rendered block resolves to nothing and crashes the mount. Core keeps the label templates adjacent to the field, inside the same visible container; do the same.
Working examples
Global selectors, dropped options and a dead template
Version compatibility
| Version | Status | Notes |
|---|---|---|
| Odoo 20.0 | Partial / changed | Not released. New first_element option, reversed default order, collision fix. See below. |
| Odoo 19.0 | Verified | Introduced here, in the hr module. |
| Odoo 18.0 | Not available | Widget does not exist. |
| Odoo 17.0 | Not available | Widget does not exist. |
| Odoo 16.0 | Not available | Widget does not exist. |
Upgrade note. Nothing to migrate into 19: the widget is new. When 20 lands, re-check every usage's option set: without the new first_element option the radio order reverses to No first, which silently changes the visual default of existing forms.
What is changing in Odoo 20
Common problems and fixes
| Symptom | Cause and fix |
|---|---|
| Props validation error, field never renders | One or both label options are missing; both are required props. Pass yes_label_element_id and no_label_element_id in the options dictionary. |
| Crash at mount referencing null innerText | The referenced ids do not exist in the DOM when the widget mounts. Place the label elements next to the field, inside the same rendered container. |
| Radio labels are empty | The label elements exist but hold no text, or the ids point at the wrong elements. Check the ids match and the template elements contain plain text. |
| Two boolean_radio fields show the same labels | The 19 implementation targets radios with a global selector; the first widget on the page wins. Keep one boolean_radio per screen in 19; the development branch fixes the selector. |
| horizontal option is ignored | extractProps forwards only readonly and the two ids, dropping the base radio options. Accept vertical stacking in 19; horizontal starts working on the development branch. |
Boolean radio field vs the alternatives
| Widget | Best for | Key difference |
|---|---|---|
boolean_radio | A consequential yes/no where each answer needs a full explanatory sentence | Boolean as two radios; labels copied at mount from view elements named by two required options |
| radio | Selections and many2ones as radio buttons with native labels | Labels come from the field's own values; supports horizontal; no boolean support |
| boolean | The standard compact checkbox | One control, label to the side; no room for per-answer explanations |
| boolean_toggle | A switch that saves immediately | Autosaving toggle; visual state only, no explanatory text |
Frequently asked questions
Why do the labels live in the view instead of the options?+
What are those template elements in the core views?+
Can I put two boolean_radio fields on the same form?+
Can the radios sit side by side instead of stacked?+
Does clicking a radio save the record?+
HR settings your managers keep second-guessing?
Accrual plans, overtime rules and approval chains fail through unclear forms more than bad logic. Hire our Odoo developers to build self-explaining HR configuration screens, sentence-labeled choices included, that your team gets right the first time.
Book a free consultation