Odoo Help


How to color a field in tree view?

on 5/26/14, 8:20 AM 2,241 views

Hi, I want to know how to color a field in the tree view list?

Example: to color in red the field my_field


Dhinesh - Technical Consultant, Sodexis Inc

--Dhinesh - Technical Consultant, Sodexis Inc--
Dhinesh - Technical Consultant, Sodexis Inc
| 5 4 9
Pondicherry, India
--Dhinesh - Technical Consultant, Sodexis Inc--

Passionate coder in Python/OpenERP. Knows Django/Flask MVC frameworks. Did code in Java, PHP.

Contact me at: dvdhinesh.mail@gmail.com

Dhinesh - Technical Consultant, Sodexis Inc
On 5/26/14, 8:33 AM

Hi, use the below example code...

In py file

'status' : fields.selection([('single','Single'),('married','Married')],'Status?'),

In xml file

<tree string="Status" colors="red:shop=='single';green:shop=='married' ">

<field name="name"></field>

<field name="status"></field>


This will colour the whole line, not one single field.

René Schuster
on 5/26/14, 8:39 AM
On 5/26/14, 11:18 AM

Ok thanks, but in this way, the line will be colored in green or red. I want this: name will be colored in green and status in red for example. Thanks

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 5/26/14, 8:20 AM
Seen: 2241 times
Last updated: 3/16/15, 8:10 AM