boolean_toggle
The boolean_toggle widget renders a boolean as a switch, and by default a flip saves the record immediately. That one behavior is most of what you need to know about it.
| Studio name | Toggle |
|---|---|
| Technical name | boolean_toggle |
| Field types | boolean |
| Views | form, list, kanban |
| Module | web, present in every Odoo database |
| Used in core | 66 occurrences across 31 modules, active flags and configuration lists throughout |
| Versions | Odoo 20.0, Odoo 19.0, Odoo 18.0, Odoo 17.0, Odoo 16.0 |
| No-code setup | Yes, via Odoo Studio (Enterprise) |
| Alternatives | boolean, boolean_favorite, boolean_icon, upgrade_boolean |
What the toggle widget does
What this means for your team
Setting it up in Odoo Studio (no code)
What Studio cannot do here
Supported options in Odoo 19
| Option | Type | What it does |
|---|---|---|
autosave | boolean | Save the record immediately when the switch flips. The save commits the whole record, including other pending edits. Set False for checkbox-like semantics with the switch look.(default: true) |
The save is a record save, not a field save. The source passes { save: autosave } to record.update, and saving a record persists all its pending changes. On a form with unsaved edits, flipping an autosave toggle commits those edits too. This is the widget's only real trap; plan it, or disable autosave where it matters.
Working examples
What autosave really commits
Version compatibility
| Version | Status | Notes |
|---|---|---|
| Odoo 20.0 | In development | Not released. The development branch shows no behavior changes; see below. |
| Odoo 19.0 | Verified | Verified against the shipped source and tested on a clean database. |
| Odoo 18.0 | Verified | Same option and behavior. No XML changes needed. |
| Odoo 17.0 | Verified | Same option and behavior. No XML changes needed. |
| Odoo 16.0 | Verified | Same option and behavior. No XML changes needed. |
Upgrade note. The option and the default are unchanged from Odoo 16 through 19; views carry over untouched. If an upgraded database suddenly saves on toggle where it previously did not, a custom view was overriding the widget before and lost the override in migration.
What is changing in Odoo 20
Common problems and fixes
| Symptom | Cause and fix |
|---|---|
| Flipping the toggle saved edits I had not finished | Autosave commits the whole record, pending edits included. Set autosave: False on toggles that live on heavily edited forms. |
| Toggle click shows an access error | The instant save surfaces write-permission failures at the click. Same fix as any access issue; the toggle just reports it earlier. |
| Automation fired ten times from one list | Each row's flip is its own record save. Expected; make automations idempotent or gate them on more than the flag. |
| Toggle is greyed out | A readonly condition, inherited from the boolean base, applies. Check the field and view readonly expressions. |
| Change did not persist after leaving the page | autosave: False was set and the record was never saved. Save normally, or drop the option if instant persistence was wanted. |
Toggle widget vs the alternatives
| Widget | Best for | Key difference |
|---|---|---|
boolean_toggle | Flags where flipping should take effect immediately | Switch styling plus record save on change (default on) |
boolean | Ordinary yes/no inside documents | Checkbox; changes wait for the normal save |
boolean_favorite | Marking records as favorites | Star icon toggling on click, list-friendly |
boolean_icon | Compact icon-style yes/no | Custom icon instead of a switch |
| upgrade_boolean | Enterprise-feature settings on Community | Opens the upgrade dialog instead of just storing a value |
Frequently asked questions
How do I show a boolean as a switch in Odoo?+
Does boolean_toggle save automatically?+
Why did other edits on my form get saved when I flipped a toggle?+
Toggle or checkbox, which should I use?+
Can I make the toggle conditional or read-only?+
Do automations trigger when a toggle is flipped?+
Settings screens that behave like settings?
Choosing where instant-save toggles help and where they bite, and wiring the automations they trigger, is everyday Odoo UX work for us. We tune forms, lists and the logic behind them on Odoo 16 through 19.
Book a free consultation