How to Change Color of A Tree View’s Lines in Odoo

Odoo has this nice features which allow to change colors of tree lines based on condition.

Starting from Odoo version 9, decorationsare used in tree XML instead of colors.

  • 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

How to add decorations to tree view’s xml

<tree string="Model data" decoration-danger="type_=='bimonthly'" decoration-success="name=='AA'">
    <field name="name"/>
    <field name="customer_id"/>
    <field name="type"/>

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top

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

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.