Add Colors in Tree View in Odoo

Hello Odooers, Odoogig and Odoo Lovers,

In this Odoo Technical Tutorial, I would like to explain how to add colors in tree view odoo.

Sometime, it’s required to show the odoo tree view lines record in different colours to easy identification.like green colour for indicate approved record, red colour for expectation record. We will show how can we change list view lines colours based on condition.

  • Below screen show how normal tree view looks in odoo
normal tree view in odoo
normal tree view in odoo
  • You can change colors of each record based on the condition in tree view
  • For eg., a record has 4 states so you can set different colors for each state, so when you see records in tree view then you can easily identify the record
  • Below example shows how to add colors in tree view of odoo

Example to change colors in odoo

  • As shown decoration is used to set different colors based on condition
  • In above eg., if state is done then color of record will be green in tree view, if state in cancel then color of record will be red in tree view
  • It means using decoration with success will return green color and decoration with danger will return red color.
  • For more colors you can refer below odoo color  chart
SyntaxEffect
decoration-bfRecord will be bold
decoration-itRecord will be italic
decoration-dangerRecord will be light red
decoration-infoRecord will be light blue
decoration-mutedRecord will be light grey
decoration-primaryRecord will be light purple
decoration-successRecord will be light green
decoration-warningRecord will be light brown

 

  • Below screen shows that how tree view in odoo will look with colors
Tree view with colors in odoo
Tree view with colors in odoo

 

LEAVE A REPLY

Leave a Reply

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