In Odoo it is possible to change the color or text style of a column in a list view using the “decoration” attributes.
The syntax for them is decoration-<style>
where the style can be one of the following options:
- Color:
info
,warning
,danger
,muted
,primary
andsuccess
- Text style:
bf
(bold) andit
(italic)
The color that each of the color-styles represents can be seen in the image below:
These attributes, as most of the Odoo attributes in the views, accept as a value python-based condition. The style is displayed when the condition is evaluated as boolean True
. In case when the color need to be applied to the column without condition the value can be simply set to 1
or True
An example of using the attributes in the view is shown below:
In case the attributes are used together with the attribute widget="badge"
then the color will apply as a background color of the badge.