Skip to main content
iVentureTeam

priority_switch

Project tasks use priority_switch, not the plain priority widget. The stars look identical; the difference lives entirely in the command palette.

Siddharth JambukiyaSiddharth JambukiyaOdoo Techno-Functional Consultant
August 21, 2026Updated August 21, 20266 min read
Technical namepriority_switch
Field typesselection
Viewsform, list, kanban
Moduleproject
Used in core4 occurrences across 2 modules: project task forms and project_todo
VersionsOdoo 20.0, Odoo 19.0, Odoo 18.0, Odoo 17.0
No-code setupNo. Applied via the widget attribute in view XML
Alternativespriority, state_selection, project_task_state_selection, selection_badge

What the Priority switch does

Priority on an Odoo task is a selection field, usually two values, rendered as stars. The generic priority widget draws those stars and offers a single command palette entry that opens a submenu. priority_switch, defined in the project module, subclasses it and rewrites only the commands getter: it maps the selection values to individual commands, one per level, each named "Set priority as %s" with the level's label filled in.

All of those commands carry the same alt+r hotkey and an isAvailable check that hides the level the record is already on. With Odoo's default two-value priority (Normal and High), that arithmetic means exactly one command is available at any moment, so pressing Alt+R on a task form flips the star on or off without ever opening a menu. On a customized selection with more levels, Alt+R triggers the first available level and the rest remain reachable through the palette by name.

What this means for your team

This is a widget about speed for heavy keyboard users, and it only pays off if your team knows it exists. A dispatcher triaging forty tasks a morning does not want to reach for the mouse to star the urgent ones; Alt+R from the task form does it in a keystroke, and typing "Set priority" into the command palette (Ctrl+K) shows every level by name.

The design also carries a small data-quality lesson for customizers. Teams routinely extend task priority to four or five levels, then discover users only ever set the extremes. Because this widget surfaces each level as a first-class named command, a longer scale at least stays reachable from the keyboard, but the underlying star row still requires precise clicking. If you extend the selection, test the experience in kanban, where stars are small and mis-clicks change data, and consider whether two levels plus a separate urgency field serves the process better.

If your priority process involves automatic escalation, follow-up activities, or SLA timers, none of that belongs in the widget; it needs automation rules or server code triggered by the field's value.

Supported options in Odoo 19

Verified against project_task_priority_switch_field.js in the Odoo 19.0 project module. The widget declares no options of its own and inherits the single option of the base priority widget.

OptionTypeWhat it does
autosavebooleanInherited from the base priority widget. When true, changing the priority saves the entire record immediately, including other pending edits. Deleted on the Odoo 20 development branch.(default: true)

Autosave saves the whole record. The default is true, so a star click or Alt+R on a form with unsaved required fields triggers a full save and can surface validation errors that seem unrelated to priority. Set options="{'autosave': False}" where that is unwanted.

Working examples

As core uses it on the task form

<field name="priority" class="h3 pe-2" widget="priority_switch"/>

Without immediate save

<field name="priority" widget="priority_switch"
       options="{'autosave': False}"/>

The star toggles as a pending edit and commits with the normal form save.

On a custom model

<field name="urgency" widget="priority_switch"/>

Works on any selection field once the project module is installed. Each selection value after the first renders as one star, and each value gets its own palette command.

One getter, three consequences

The whole widget is one getter. The base class builds a single command; the subclass builds an array:

get commands() {
    return this.options.map(([id, name]) => [
        _t("Set priority as %s", name),
        () => this.updateRecord(id),
        { category: "smart_action", hotkey: "alt+r",
          isAvailable: () => this.props.record.data[this.props.name] !== id },
    ]);
}

Three details follow from the source. First, this.options is the full selection list including the first "no star" value, so "Set priority as Normal" is a real command: the keyboard can clear a priority, something the star row itself only does via the click-current-star-to-clear behavior inherited from the base widget. Second, the shared hotkey is resolved by availability, so Alt+R is deterministic only when exactly one command is available, which is the two-level case. With three or more levels, rely on the palette names rather than the hotkey. Third, extractProps sets withCommand to true only for viewType === "form", so none of this exists in list or kanban views; there the widget is behaviorally identical to plain priority.

Version compatibility

VersionStatusNotes
Odoo 20.0Partial / changedNot released. Widget file unchanged, but the inherited autosave option is deleted upstream; details below.
Odoo 19.0VerifiedVerified against the shipped source.
Odoo 18.0VerifiedIdentical to 19.0 apart from a header comment.
Odoo 17.0VerifiedWidget introduced in this version with the same behavior.
Odoo 16.0Not availableWidget does not exist; task views use the plain priority widget.

Upgrade note. Present and unchanged from Odoo 17 through 19 apart from a header comment. Views moved from 16 need the widget name added, since 16 predates it and used the plain priority widget on tasks.

What is changing in Odoo 20

Odoo 20 is expected at Odoo Experience in Brussels, 24 to 26 September 2026. These notes are read from the public development branch, which remains unstable until feature freeze; we re-verify against the shipped release.

The widget's own file is unchanged on master. Upstream, the base priority widget it extends deletes the autosave option: the update call no longer takes a save flag, so options="{'autosave': False}" would stop having any effect through this widget as well. The base widget also reworks how the current level's label is displayed next to the stars. If your views or tests depend on the no-autosave configuration, plan a retest on Odoo 20.

Common problems and fixes

SymptomCause and fix
Alt+R does nothing in list or kanban viewCommands register only when viewType is form. Open the record's form view; keyboard priority switching is form-only by design.
Alt+R seems to pick a priority at random with a customized selectionAll level commands share the hotkey and the first available one wins, which is only predictable with two levels. Use the command palette entries by name for selections with three or more levels.
Clicking a star raises required-field errorsAutosave defaults to true and saves the whole record. Add options="{'autosave': False}" or complete the required fields first.
Clicking the highest star cleared the priority insteadInherited base behavior: clicking the star matching the current value resets to the first selection value. No fix needed; click a different star to set that level.
Widget not found error on a non-project databasepriority_switch is registered by the project module, not web. Install project, or fall back to the plain priority widget.

Priority switch vs the alternatives

WidgetBest forKey difference
priority_switchTask priority with fast keyboard triageOne named palette command per level, all on Alt+R
priorityPriority stars anywhere outside projectSingle generic palette command instead of one per level
state_selectionStatus dots with a dropdownColored bubble plus menu rather than a star row
project_task_state_selectionTask lifecycle statesPurpose-built state machine display for tasks
selection_badgeVisible one-click level pickersEvery level shown as a labeled badge, no icons

If users triage from the keyboard, this widget earns its place. If priority is set by automation or seldom touched, the plain priority widget is indistinguishable in practice.

Frequently asked questions

What is the difference between priority and priority_switch?+
Rendering is identical. priority_switch replaces the single "Set priority..." command palette entry with one entry per selection level, each labeled "Set priority as ...", all sharing Alt+R and hiding the level the record is already on. Everything else, including options, is inherited.
Why does Alt+R toggle the star on and off?+
With the default two-value priority, the command for the current value hides itself, leaving exactly one available command. Alt+R therefore always switches to the other value, which feels like a toggle. This is why the widget is named a switch.
Can I use priority_switch on my own selection field?+
Yes, on any selection field, provided the project module is installed since that is where the widget registers. Values after the first each render as a star, and every value gets a named command in form views.
Does setting a priority save the record immediately?+
By default yes. The inherited autosave option is true and saves the whole record, pending edits included. Pass options="{'autosave': False}" to make it a normal pending edit instead.
How do users clear a priority from the keyboard?+
The first selection value is a real command too, so opening the palette and choosing "Set priority as Normal" (or your first level's label) clears the stars. With two levels, Alt+R from a starred record does the same.
Will priority_switch change in Odoo 20?+
Its own file shows no changes on the development branch, but the base priority widget deletes the autosave option there, which would affect this widget's inherited behavior. Unreleased until the September 2026 launch; we re-verify then.

Priority that actually drives the queue?

Stars are the easy part. Escalation rules, SLA timers, and priority-driven assignment are where task management earns its keep, and where Odoo needs deliberate configuration or a small custom module. We build exactly that layer on Odoo 16 through 19.

Book a free consultation

How this page was produced

This page was verified by reading project_task_priority_switch_field.js on the Odoo 19.0 branch alongside the base priority_field.js, and diffing both against 16.0, 17.0, 18.0, and master. The command behavior, hotkey sharing, and form-only registration are taken directly from the commands getter and extractProps in the source, and were exercised on a clean Odoo 19 database where the screenshot was captured. Found a discrepancy? Tell us.