label_selection
Paid in green, Cancelled in red: label_selection paints a selection value as a colored label using one option, classes, a plain mapping from value to color. It displays; it never edits.
| Technical name | label_selection |
|---|---|
| Field types | selection |
| Views | list, form, kanban (display only in all of them) |
| Module | web, present in every Odoo database |
| Used in core | 16 occurrences across 13 modules, including account, stock, point_of_sale, survey, lunch, payment |
| Versions | Odoo 20.0, Odoo 19.0, Odoo 18.0 |
| No-code setup | No. The classes mapping is written in view XML |
| Alternatives | badge, selection_badge, statusbar |
What the Label Selection widget does
What this means for your team
Supported options in Odoo 19
| Option | Type | What it does |
|---|---|---|
classes | object (map) | Maps selection keys to Bootstrap contextual color names, e.g. {'done': 'success', 'cancel': 'danger'}. Values not in the map render with the hardcoded fallback color primary. |
The map keys are selection keys, not labels. Write {'done': 'success'}, not {'Done': 'success'}, keys are matched against the stored value. Valid color names are the Bootstrap contextual set (primary, secondary, success, danger, warning, info, light, dark); anything else produces an unstyled class and a gray-ish label.
Working examples
label_selection vs badge: the practical difference
Version compatibility
| Version | Status | Notes |
|---|---|---|
| Odoo 20.0 | In development | Not released. No changes visible on the development branch; see below. |
| Odoo 19.0 | Verified | Verified against the shipped source and template. |
| Odoo 18.0 | Verified | The 18.0 and 19.0 files are byte-identical. Verified directly. |
What is changing in Odoo 20
Common problems and fixes
| Symptom | Cause and fix |
|---|---|
| Every label is blue | The classes map is missing, misspelled, or keyed by labels instead of selection keys; everything falls back to primary. Key the map by the technical selection keys and check the option syntax. |
| One state shows the wrong color after adding a selection value | The new key is not in the map, so it renders primary. Extend the classes map whenever the selection grows; the widget will not warn you. |
| Users cannot change the status | By design: the template has no edit mode. Expose the state through statusbar, selection_badge or buttons elsewhere in the view. |
| Label shows the technical key instead of the label | The field is rendered without the widget or is not a selection field. Confirm widget="label_selection" and a selection field; the widget always prints the translated label. |
| Custom color name has no effect | Only Bootstrap contextual names produce text-bg-* classes that exist in the stylesheet. Stick to primary, secondary, success, danger, warning, info, light, dark, or add matching CSS for custom names. |
Label Selection widget vs the alternatives
| Widget | Best for | Key difference |
|---|---|---|
label_selection | Status columns scanned for exceptions | Static value-to-color map, primary fallback, structurally incapable of editing |
| badge | Labels colored by conditions beyond the field's value | Colors via decoration-* expressions; also takes many2one and char |
| selection_badge | Choosing between few options with pills | Editable; renders plain text in readonly |
| statusbar | Pipeline stages at the top of forms | Editable arrow bar showing all stages |
Frequently asked questions
How do I color a status field in an Odoo list view?+
Which colors can I use?+
Why is my label blue when I mapped it to another color?+
Can users edit the value with this widget?+
label_selection or badge, which should I use?+
Does it work on kanban cards?+
Can your team see problems at a glance?
Color-coded lists, exception-first dashboards, KPIs that surface the five records needing action today: operational visibility in Odoo is mostly configuration, done right. We tune views, filters and dashboards across Odoo 16 to 19 so the screen answers before anyone asks.
Book a free consultation