This module aims to add support for dynamically coloring fields in tree view according to data in the record.
Features
- Add attribute bg_color on field's options to color background of a cell in tree view
- Add attribute fg_color on field's options to change text color of a cell in tree view
auto_awesome What this module does
AI-generated from the code · Odoo 18.0Lets developers color cells in any tree (list) view based on each record's data, using background and text color rules defined in the field options.
This module adds a way to color individual cells in tree (list) views depending on the data of each row. It is a technical building block: it does not add menus or screens by itself, but other modules can use it to make lists easier to read.
- For any field shown in a tree view, you can define a background color and a text color through the field's options.
- Each color rule is written as a color followed by a condition, separated by a colon; several rules can be chained with semicolons.
- When a condition is true for a record, that color is applied to the cell. If several conditions match, the last matching one wins, so a general default rule can be placed first and more specific rules after it.
- If only a color is given without a condition, it is applied to every row.
The coloring is applied live in the browser when the list is displayed, so it follows the data currently shown, including after filtering or sorting. The module patches the list renderer and extends the list row template to add the computed style to each field cell.
A demo view on res.users shows the feature: the login date cell turns dark red with white text when the user has never logged in, and the name cell is blue, or purple for the admin user, with white text. The module depends only on web.
Depends on
Required by other modules
Text generated by AI (DeepSeek) from reading the Odoo 18.0 code on GitHub; it may contain mistakes, so check the code before deciding. View the code on GitHub
Availability by version
Reviewed: 2026-11-03Confirmation status: 7 confirmed, 2 with no information of 9 versions.
Sources · Odoo 18.0
Confirmed on 2026-11-03 in branch 18.0 of OCA/web.
terminal Installation and usage
OCA documentation · Odoo 18.0Usage
Source · Odoo 18.0- In the tree view declaration, put
options='{"bg_color": "red: customer==True"}attribute in thefieldtag: ... ... ... ... With this example, column which renders 'name' field will have its background colored in red on customer records. - In the tree view declaration, put
options='{"fg_color": "white:customer == True"}'attribute in thefieldtag: ... ... ... ... With this example, column which renders 'name' field will have its text colored in white on customer records. - If you want to use more than one color, you can split the attributes using ';':
options='{"fg_color": "red:red_color == True; green:green_color == True"}'Example:
...
<field name="arch" type="xml">
<tree string="View name">
...
<field name="name" options='{"fg_color": "red:red_color == True; green:green_color == True"}'/>
...
</tree>
</field>
...- Can use strings too... In the tree view declaration, put
options="{'fg_color': 'green:customer_state == \'success\''}"attribute in thefieldtag: ... ... ... ...
Note that you can use single or normal quotes. If the declaration of the options doesn't follow the JSON format, the options string will be evaluated using py.eval()
No verified information in OCA: Installation, Configuration.
Installation instructions, the distribution package, dependencies and configuration steps are not shown because they have not yet been verified in the module documentation for any version.
Data imported from GitHub: this sheet reflects the latest catalog review, not a live lookup. Always check the module documentation and staging before installing in production.