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"/>
</tree>

Leave a Comment

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

Scroll to Top