Skip to main content
iVentureTeam

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.

August 11, 2026Updated August 11, 20265 min read
Odoo 19 settings-style list where the Active column renders as boolean_toggle switches, one mid-flip.
Studio nameToggle
Technical nameboolean_toggle
Field typesboolean
Viewsform, list, kanban
Moduleweb, present in every Odoo database
Used in core66 occurrences across 31 modules, active flags and configuration lists throughout
VersionsOdoo 20.0, Odoo 19.0, Odoo 18.0, Odoo 17.0, Odoo 16.0
No-code setupYes, via Odoo Studio (Enterprise)
Alternativesboolean, boolean_favorite, boolean_icon, upgrade_boolean

What the toggle widget does

A checkbox records a choice; a switch does something. That is the design language this widget buys you, and Odoo backs the look with matching behavior: the source extends the standard boolean field and overrides one method, onChange, which updates the value and, when autosave is on, saves the record in the same breath.

Autosave is the default, verified in extractProps: unless the option is explicitly false, every flip is a commit. In a list view that means toggling ten rows is ten saved records with no Save button involved, which is exactly why core uses it for active flags and configuration tables.

What this means for your team

Use the toggle where flipping is the action: activating a carrier, publishing a product, enabling a rule. Users get the instant-effect behavior the switch shape promises, and admin screens stop needing save-button choreography.

The same instantness is the caution. Because the save commits the whole record, a toggle on a form quietly persists every other half-typed edit on it, and automations watching the record fire immediately. On records where edits are usually deliberate and batched, quotations, invoices, anything with validation, either set autosave: False or stay with the plain checkbox, and keep the switch for genuinely switch-like flags.

Our rule on implementations: toggles in lists and settings pages, checkboxes inside documents.

Setting it up in Odoo Studio (no code)

Studio applies this widget without code.

  1. Open the view in Studio and select the boolean field.

  2. In Properties, set Widget to Toggle. The Autosave checkbox Studio shows corresponds to the option below.

What Studio cannot do here

Nothing meaningful is XML-only for this widget; the single option is exposed. What Studio cannot decide for you is the judgment call above, where instant saving is appropriate.

Supported options in Odoo 19

Verified against boolean_toggle_field.js in the Odoo 19.0 web module. One option, and a default worth reading twice.

OptionTypeWhat it does
autosavebooleanSave 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

Active flag in a list

<field name="active" widget="boolean_toggle"/>

Each flip archives or restores that row immediately, no save step.

Toggle without instant saving

<field name="is_published"
       widget="boolean_toggle"
       options="{'autosave': False}"/>

The switch look with checkbox semantics: the change rides along with the normal record save.

Read-only under a condition

<field name="is_locked"
       widget="boolean_toggle"
       readonly="state != 'draft'"/>

Standard readonly expressions apply unchanged, inherited from the boolean base.

What autosave really commits

Because a flip can be a save, everything downstream of a save happens per flip, and that is worth spelling out once.

Automations and computed fields run immediately. An automated action on the field, or on the record's write, fires at the click. Ten toggles in a list are ten separate writes, ten automation runs, ten log entries.

Access errors surface at the click. With a checkbox, a user without write rights finds out at save time; with an autosave toggle, the click itself errors. Same rule, earlier feedback.

Concurrent edits get interesting. If another user changed the record since it loaded, the flip's save meets Odoo's standard concurrency handling right away rather than at a later save. Rare, but support tickets about "the toggle refused" are usually this.

Version compatibility

VersionStatusNotes
Odoo 20.0In developmentNot released. The development branch shows no behavior changes; see below.
Odoo 19.0VerifiedVerified against the shipped source and tested on a clean database.
Odoo 18.0VerifiedSame option and behavior. No XML changes needed.
Odoo 17.0VerifiedSame option and behavior. No XML changes needed.
Odoo 16.0VerifiedSame 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

Odoo 20 is expected at Odoo Experience in Brussels, 24 to 26 September 2026. The changes below are read from the public development branch and are not final until release.

Nothing changes for this widget. Same single autosave option, same true default, same record-save semantics. Internal syntax moves to the new Owl props system, affecting JavaScript patches only. We re-verify once Odoo 20 ships.

Common problems and fixes

SymptomCause and fix
Flipping the toggle saved edits I had not finishedAutosave commits the whole record, pending edits included. Set autosave: False on toggles that live on heavily edited forms.
Toggle click shows an access errorThe 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 listEach row's flip is its own record save. Expected; make automations idempotent or gate them on more than the flag.
Toggle is greyed outA readonly condition, inherited from the boolean base, applies. Check the field and view readonly expressions.
Change did not persist after leaving the pageautosave: 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

WidgetBest forKey difference
boolean_toggleFlags where flipping should take effect immediatelySwitch styling plus record save on change (default on)
booleanOrdinary yes/no inside documentsCheckbox; changes wait for the normal save
boolean_favoriteMarking records as favoritesStar icon toggling on click, list-friendly
boolean_iconCompact icon-style yes/noCustom icon instead of a switch
upgrade_booleanEnterprise-feature settings on CommunityOpens the upgrade dialog instead of just storing a value

The practical test: instant effect wanted, toggle. Deliberate batched edits, checkbox. A yes/no the user marks as a favorite or priority, the star. A yes/no that is really a state, model it as a state and use the proper widgets.

Frequently asked questions

How do I show a boolean as a switch in Odoo?+
Set widget="boolean_toggle" on the field, or pick the Toggle widget in Studio. Remember its default: flipping saves the record immediately.
Does boolean_toggle save automatically?+
Yes by default. Verified in the source: unless autosave is explicitly false, the change handler saves the record at the click. Add options="{'autosave': False}" to defer to the normal save.
Why did other edits on my form get saved when I flipped a toggle?+
Because the save is a record save: Odoo persists all pending changes on that record, not just the boolean. On forms where that is risky, disable autosave for the toggle.
Toggle or checkbox, which should I use?+
Toggle when flipping is the action and should apply instantly (active flags, settings rows). Checkbox when the value is part of a document edited and saved as a whole. The look signals the behavior, so keep them honest.
Can I make the toggle conditional or read-only?+
Yes, standard readonly expressions apply; the widget inherits them from the boolean base. A readonly toggle renders greyed and unclickable.
Do automations trigger when a toggle is flipped?+
With autosave on, immediately: the flip writes and saves the record, so automated actions, computed dependencies and webhooks all run at the click, once per flipped row.

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

How this page was produced

The option, its default, and the record-save semantics were read from the Odoo 19.0 web module source (boolean_toggle_field.js), which extends the boolean field and passes { save: autosave } on change. Confirmed on a clean Odoo 19 database, where the screenshot was captured. The Odoo 20 statement comes from the same file on the public development branch, where it is unchanged. Spotted an error? Tell us and we will correct the page.