badge
The badge widget renders a field's value as a colored pill, and its color comes from decoration expressions you write in the view or an integer color field on the record.
| Studio name | Badge |
|---|---|
| Technical name | badge |
| Field types | selection, many2one, char |
| Views | list, form, kanban |
| Module | web, present in every Odoo database |
| Used in core | 99 occurrences across 41 modules, including account, purchase, stock, project, hr_recruitment |
| Versions | Odoo 20.0, Odoo 19.0, Odoo 18.0, Odoo 17.0, Odoo 16.0 |
| No-code setup | Partly: Studio sets the widget; decoration conditions are written in XML |
| Alternatives | selection_badge, state_selection, statusbar, label_selection |
What the badge 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 |
|---|---|---|
color_field | field name | Integer field on the record (0 to 11) selecting a palette color, applied as class o_badge_color_N. When set, all decoration-* attributes are ignored; the source checks it first. |
The color field wins outright. The source checks colorField before evaluating any decoration, so setting both means the decorations are dead code. Pick one mechanism per field: conditions in the view when color follows state, a color field when color is data users manage (like tag colors).
Working examples
Where the colors really come from
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 behavior. No XML changes needed. |
| Odoo 17.0 | Verified | Same behavior. No XML changes needed. |
| Odoo 16.0 | Verified | Same behavior. No XML changes needed. |
Upgrade note. Types, the option and both color mechanisms are unchanged from Odoo 16 through 19; views migrate untouched. If badges lost color after a migration, the usual cause is a customized list view that dropped the decoration-* attributes, not the widget.
What is changing in Odoo 20
Common problems and fixes
| Symptom | Cause and fix |
|---|---|
| All badges render gray | No decoration condition matches and no color_field is set; gray text-bg-300 is the designed fallback. Add decoration-* conditions covering your states, or set color_field. |
| Decorations set but colors ignore them | A color_field option is also set, and it takes absolute precedence in the source. Remove one mechanism; they cannot combine. |
| decoration-muted looks the same as no decoration | Verified in the source: muted maps to the same text-bg-300 fallback class. Expected; use another decoration if you need a distinct look. |
| Users try to click the badge to change status | The widget is display-only by design. Use selection_badge or state_selection for in-place editing, or a button/statusbar for workflow moves. |
| Wrong color when two conditions overlap | Decorations evaluate in declaration order and the first match wins. Order conditions from most to least specific. |
Badge widget vs the alternatives
| Widget | Best for | Key difference |
|---|---|---|
badge | Read-only status color in lists and forms | Pure display pill; color from view conditions or a stored color integer |
selection_badge | Picking a value by clicking badges | Editable: renders every choice as a clickable badge |
state_selection | Kanban-style status dots with a quick menu | Compact colored dot with an inline dropdown to change state |
statusbar | Workflow position in the form header | Shows the pipeline of stages, clickable to move the record |
label_selection | Plain read-only selection labels with decoration colors | Text label instead of a pill |
Frequently asked questions
How do I show a colored status in an Odoo list view?+
Which colors can a badge have?+
Why are my badge decorations being ignored?+
Can users change the value by clicking the badge?+
Does the badge widget work on many2one and char fields?+
Badge or selection_badge, which one do I need?+
Lists your team can read at a glance?
Consistent status colors across invoices, deliveries and projects are a small view-level change with daily payoff. We apply exactly this kind of UX polish, one coherent color language across all your Odoo views, on Odoo 16 through 19.
Book a free consultation