web_ribbon
The corner banner on Odoo forms, Archived, Paid, Cancelled, is one reusable view widget: web_ribbon. It takes three attributes, and one undocumented sizing rule.
| Technical name | web_ribbon |
|---|---|
| Views | form (view widget, |
| Module | web, present in every Odoo database |
| Used in core | 157 occurrences across dozens of modules, including account, crm, calendar, base_automation, analytic |
| Versions | Odoo 20.0, Odoo 19.0, Odoo 18.0, Odoo 17.0, Odoo 16.0 |
| No-code setup | No. Ribbons are added in view XML (Studio has no ribbon element) |
| Alternatives | badge, statusbar, boolean_toggle |
What the ribbon widget does
What this means for your team
Supported options in Odoo 19
| Option | Type | What it does |
|---|---|---|
title | string (attribute) | The text on the ribbon. Keep it within about 15 characters; the widget shrinks the font past 10 and again past 15. |
bg_color | string (attribute) | Bootstrap background class for the banner: text-bg-danger, text-bg-warning, text-bg-info, and so on.(default: text-bg-success) |
tooltip | string (attribute) | Hover text on the ribbon, for the one-line explanation of the state. |
text | string (attribute) | Legacy alias for title, still read by extractProps when title is absent. Use title in new views. |
Color values are Bootstrap background classes, passed as-is to the element: text-bg-danger, text-bg-warning, text-bg-info and the rest. The source's default is text-bg-success. Anything Bootstrap accepts as a background class works, which also means a custom class of your own is legal if your assets define it.
Working examples
The hidden auto-sizing rule
Version compatibility
| Version | Status | Notes |
|---|---|---|
| Odoo 20.0 | In development | Not released. The development branch shows no changes to this widget; see below. |
| Odoo 19.0 | Verified | Verified against the shipped source and tested on a clean database. |
| Odoo 18.0 | Verified | Same attributes and behavior. No XML changes needed. |
| Odoo 17.0 | Verified | Same attributes and behavior. No XML changes needed. |
| Odoo 16.0 | Verified | Same attributes and behavior. No XML changes needed. |
Upgrade note. Older databases sometimes carry ribbons written with the text attribute or pre-Bootstrap-5 color classes like bg-danger. Both still render, but standardize on title and text-bg-* classes during a migration cleanup so views match current core conventions.
What is changing in Odoo 20
Common problems and fixes
| Symptom | Cause and fix |
|---|---|
| Ribbon never appears | The invisible expression references a field that is not loaded in the view. Add the field to the form, invisible="1" is enough, then re-test the condition. |
| Ribbon shows on every record | No invisible condition, so the widget renders unconditionally. Add invisible="..." with the state expression that should gate it. |
| Text is tiny or cramped | The auto-sizing rule: past 10 characters the font shrinks, past 15 it shrinks again. Shorten the title; check translated lengths too. |
| Color did not change | A plain color name or pre-Bootstrap-5 class was passed. Use a text-bg-* class, e.g. bg_color="text-bg-warning". |
| Two ribbons overlap | Both invisible conditions are true at the same time; the widget does not arbitrate. Make the conditions mutually exclusive. |
| Ribbon sits in the wrong place | The widget element is nested deep in the sheet instead of at its top. Declare it as the first element inside <sheet>. |
Ribbon widget vs the alternatives
| Widget | Best for | Key difference |
|---|---|---|
web_ribbon | Unmissable record state on a form: Archived, Paid, Cancelled | Pure view element, no field and no stored value; gated by an invisible expression |
| badge | State shown inline next to data, in lists and forms | A field widget rendering the value as a colored pill, one per row |
| statusbar | A workflow the user moves through | Shows all stages and allows clicking between them, in the form header |
| boolean_toggle | A state the user flips directly | An editable switch bound to a boolean field, not a display banner |
Frequently asked questions
How do I add an Archived ribbon to a custom model's form?+
Can I show a ribbon based on any condition?+
What colors can a ribbon have?+
Why is my ribbon text so small?+
Is there a way to add ribbons from Odoo Studio?+
Does web_ribbon work in list or kanban views?+
Want your record states impossible to miss?
Ribbons, badges and status logic are small view changes with outsized usability payoff, and they need someone comfortable in Odoo's view XML. We deliver exactly this kind of form polish as part of Odoo customization work on 16 through 19.
Book a free consultation