It's an awesome feature of Odoo to color tree views. For that we can use tree view attribute colors

Xml Syntax.

<tree colors="your_color:field== 'value'">


Example

<tree colors="grey:state == 'cancel'">


How to add colors to tree view in odoo 11 ?

For version 9, colors are replaced by the decorators. However it will support up to version 10.

But Odoo 11th version support decorators only

The possible decorators are 

decoration-bf - shows the line in BOLD 
decoration-it - shows the line in ITALICS
decoration-danger - shows the line in LIGHT RED
decoration-info - shows the line in LIGHT BLUE
decoration-muted - shows the line in LIGHT GRAY
decoration-primary - shows the line in LIGHT PURPLE
decoration-success - shows the line in LIGHT GREEN
decoration-warning - shows the line in LIGHT BROWN


Syntax


Example

<tree decoration-success="state=='done'">


Preview of decorators


This formatting is dependent on the bootstrap style.

Hope this will help you !


If you wish to have the latest updates from us, you may follow us on FACEBOOKTWITTERYOUTUBE etc.