Odoo Help


Is It Possible to change the tree view record colour through python file???

on 4/2/15, 2:15 PM 585 views

we would like to change the tree view record colour based on some condition for all module that's way we need solution through python function.example like in XML file 

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

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


Demirel yakito
On 4/3/15, 8:16 AM

from openerp import models, fields, api, _

class Attend(models.Model):


emp_desg=fields.Selection([('md','Managing Director'),('jt','Junior Trainee'),('so','Senior Officer')],string="Department:")


<tree string="Attendance" version="7.0" colors="blue:emp_desg=='md';green:emp_desg=='jt'">

     Here define your all fields.


i hve one selection. based on the selection values, that tree view record line color will be change.

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: 4/2/15, 2:15 PM
Seen: 585 times
Last updated: 4/3/15, 8:16 AM