Skip to main content

Change Color of Tree View’s Lines in Odoo

Do you ever wish that you could change the color of the lines in the tree view in Odoo to reflect a certain line’s state? It can be a little hard to see what is going on if all of the lines are the same color. Luckily, there is an easy way to change this! In today’s blog post, we will show you how to change the color of the tree view’s lines in Odoo.

Odoo’s Tree view offers decoration property to allow to apply each line with a class depending on a condition.

<tree string="Model data" decoration-danger="type_=='bimonthly'" decoration-success="name=='DDD'">
    <field name="name"/>
    <field name="customer_id"/>
    <field name="payment_type" string="Type"/>
</tree>

This propery is supported starting from Odoo 9.

All available decorations:

  • 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

By continuing to use the site, you agree to the use of cookies.