How to Add Colors to List View Rows and Cells in Odoo
Use decoration-* attributes to colour-code rows and individual cells in Odoo list views based on field values — with expression syntax, all decoration types, and a migration note for the tree → list rename. Verified for Odoo 18 & 19.
Odoo list views support row-level and cell-level visual styling via `decoration-*` attributes. These attributes accept the same Python expression syntax used by `invisible` and `readonly` — they evaluate against the current row's field values and apply a Bootstrap text class when the expression is truthy. This makes it straightforward to highlight overdue records in red, confirmed orders in green, or draft entries in italic without writing any custom JavaScript.
How List View Row Colouring Works
Decoration attributes are placed on the `` element (formerly ``) to colour entire rows, or on individual `` elements inside the list to colour only that cell. Each attribute takes a Python expression string. When the expression evaluates to `True` for a given record, Odoo adds the corresponding Bootstrap CSS class to the row or cell element.
Decoration Attributes Reference
| Attribute | CSS class applied | Visual effect | Common use case |
|---|---|---|---|
| decoration-success | text-success | Green text | Confirmed, done, paid records |
| decoration-warning | text-warning | Orange / amber text | Pending, in-progress, needs attention |
| decoration-danger | text-danger | Red text | Overdue, cancelled, blocked, errors |
| decoration-info | text-info | Blue / cyan text | Informational, draft, new records |
| decoration-muted | text-muted | Grey / dimmed text | Archived, inactive, cancelled records |
| decoration-primary | text-primary | Primary brand colour | Highlighted or selected records |
| decoration-bf | fw-bold (font-weight bold) | Bold text | Important rows, totals, high-priority |
| decoration-it | fst-italic (font-style italic) | Italic text | Draft, estimated, or provisional records |
Row-Level Decoration (Entire Row)
<!-- Row-level decoration on the <list> element -->
<!-- Each decoration-* attribute colours ALL cells of a matching row -->
<list decoration-success="state == 'sale'"
decoration-warning="state == 'draft'"
decoration-danger="date_deadline and date_deadline < current_date"
decoration-muted="state == 'cancel'"
decoration-bf="priority == '2'"
decoration-it="state == 'draft'">
<field name="name"/>
<field name="partner_id"/>
<field name="date_deadline"/>
<field name="amount_total"/>
<field name="state"/>
<field name="priority" column_invisible="True"/>
<!-- ↑ Include fields used in expressions even if not shown as columns -->
</list>Cell-Level Decoration (Individual Field)
You can also apply `decoration-*` to an individual `` element inside the list. The decoration then applies only to that column's cell, leaving the rest of the row unstyled. This is useful when you want to highlight a specific value — such as making overdue dates red while keeping the row itself neutral.
<!-- Cell-level decoration — only that field's cell is styled -->
<list>
<field name="name"/>
<field name="partner_id"/>
<!-- Colour the deadline cell based on urgency -->
<field name="date_deadline"
decoration-danger="date_deadline and date_deadline < current_date"
decoration-warning="date_deadline and date_deadline == current_date"/>
<!-- Highlight the amount when it exceeds a threshold -->
<field name="amount_total"
decoration-success="amount_total >= 10000"
decoration-warning="amount_total > 0 and amount_total < 10000"
decoration-muted="amount_total == 0"/>
<field name="state"
decoration-success="state == 'sale'"
decoration-danger="state == 'cancel'"
decoration-it="state == 'draft'"/>
</list>The tree → list Rename (Odoo 16)
| Odoo version | <tree> element | <list> element | decoration-* support | Recommendation |
|---|---|---|---|---|
| Odoo 15 | ✓ Canonical name | ✗ Not recognised | ✓ Supported on <tree> | Use <tree> |
| Odoo 16 | ✓ Alias (works) | ✓ New canonical name | ✓ Supported on both | Use <list>, migrate <tree> |
| Odoo 17 | ✓ Alias retained | ✓ Canonical | ✓ Supported on both | Use <list> |
| Odoo 18 & 19 | ✓ Alias retained | ✓ Canonical | ✓ Supported on both | Use <list> |
Combining Multiple Decorations
You can combine colour decorations with font decorations on the same element. When multiple decoration expressions are true simultaneously, all matching CSS classes are applied. A common pattern is bold + colour for priority records.
<!-- Bold + red for high-priority overdue records -->
<list decoration-danger="priority == '2' and date_deadline and date_deadline < current_date"
decoration-bf="priority == '2'"
decoration-warning="state == 'draft'"
decoration-it="state == 'draft'"
decoration-muted="state == 'cancel'">
<field name="name"/>
<field name="date_deadline"/>
<field name="state"/>
<field name="priority" column_invisible="True"/>
</list>Using current_date in Decoration Expressions
`current_date` is a special variable available in list view decoration expressions (and in domain strings). It holds today's date as a `datetime.date` object, allowing date comparisons without hardcoding values. It is also available as a string in ISO format (`'YYYY-MM-DD'`) when used in domain strings.
<!-- Highlight overdue records (deadline passed) in red -->
<!-- Highlight due-today records in orange -->
<!-- Highlight upcoming (within 7 days) in info blue -->
<list
decoration-danger="date_deadline and date_deadline < current_date"
decoration-warning="date_deadline and date_deadline == current_date"
decoration-info="date_deadline and date_deadline > current_date">
<field name="name"/>
<field name="date_deadline"/>
</list>Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
| Decoration never applies — rows remain unstyled | Field used in expression is not loaded (not included as a <field> element in the list) | Add the field with column_invisible="True" so Odoo loads the value for expression evaluation. |
| XML parse error when using < or > in expression | < and > are reserved XML characters and must be escaped inside attribute values | Replace < with < and > with > inside the decoration attribute string. |
| Decoration applies to wrong rows (always true or always false) | Expression references a field whose value is always the same (e.g. a relational ID instead of the selection value) | Check the field type: selection fields use string values like 'done', not integers. Many2one fields compare IDs (integers), not display names. |
| Two colour decorations both active — unexpected colour shown | Two decoration expressions are simultaneously true; CSS specificity determines which wins | Make the expressions mutually exclusive using 'and not' or 'and state != ...' to ensure only one is true at a time. |
| decoration-bf or decoration-it not visible | A custom theme CSS overrides Bootstrap's fw-bold or fst-italic classes | Inspect the row element in browser dev tools to confirm the class is added. If overridden, add a custom CSS rule in your module's SCSS with !important or higher specificity. |
Version Notes
| Odoo version | Key changes affecting list view decoration |
|---|---|
| Odoo 15 | decoration-* attributes supported on <tree>. attrs used for row visibility (deprecated in Odoo 16). current_date available. |
| Odoo 16 | <tree> renamed to <list> (alias retained). attrs deprecated — use invisible on <field>. column_invisible introduced for hiding columns. |
| Odoo 17 | attrs removed. <list> canonical; <tree> retained as alias. decoration-* API unchanged. Bootstrap 5 classes (fw-bold, fst-italic) replace older Bootstrap 4 names for decoration-bf/decoration-it. |
| Odoo 18 & 19 | No breaking changes to decoration-* attributes. <list> remains canonical, <tree> alias still works. |
Need Custom List View Styling or a Full Odoo Module Upgrade?
Our Odoo-certified developers handle view customisation, module upgrades from Odoo 15 to 18/19, and full compliance verification for Saudi businesses — ZATCA, GOSI, and PDPL.
Frequently Asked Questions
Can I use decoration-* on buttons or other elements inside a list view?
Why does decoration-danger on date_deadline not work when the field is empty?
Can I apply a background colour instead of just text colour?
Is decoration-* available in Kanban or form views?
Can I combine decoration-bf (bold) with a colour like decoration-danger?
My list view has many decoration conditions and is getting hard to read. Is there a cleaner approach?

iWesabe Editorial Team
Practitioner insights on Odoo ERP, ZATCA compliance, and Saudi enterprise digital operations — written by iWesabe's consulting, finance, and engineering teams.
Related Articles
Context and Domain in Odoo — Developer Reference (Odoo 16–19)
A practical guide to Odoo domains (record filtering) and context (key–value state passing) — how they work, where they appear, and the syntax rules for Odoo 16 through 19. Verified for Odoo 18 & 19.
Odoo attrs Deprecated: Migrating to invisible, readonly, and required in Odoo 16–19
The attrs dictionary was deprecated in Odoo 16 and removed in Odoo 17. This guide maps every attrs pattern to its direct-attribute replacement — with before/after code for the most common use cases. Verified for Odoo 18 & 19.
Access Security in Odoo — ir.model.access.csv and Record Rules (Odoo 16–19)
A complete developer reference for Odoo's two-layer security system: model-level CRUD permissions via ir.model.access.csv and record-level filtering via ir.rule. Verified for Odoo 18 & 19.
Explore Related Solutions
CRM & Customer Relationship Management
Turn every lead into a closed deal. Odoo CRM gives your sales team a structured Kanban pipeline, automated follow-up sequences, and a 360° customer view — all connected natively to Accounting, Inventory, and Email Marketing.
ExploreFinancial Management
Automate your Saudi Arabia accounting — ZATCA Phase 2 e-invoicing, VAT returns, Zakat provisioning, multi-currency bank reconciliation, and real-time financial reporting — all inside one connected Odoo platform. Fully localised for KSA and the GCC by iWesabe.
ExploreManufacturing Management ERP
Run lean, traceable production with Odoo Manufacturing — work orders, Bills of Materials, quality control, and real-time OEE dashboards built for KSA factory floors.
ExploreSupply Chain Management
From purchase order to final delivery — Odoo Supply Chain connects procurement, multi-warehouse inventory, demand forecasting, and vendor management into one real-time platform. Purpose-configured for Saudi Arabia and the GCC by iWesabe.
Explore