Odoo Help


Set color in Tree view based on "task stage"

Zohair Iyaz
on 12/15/15, 6:53 AM 3,674 views

I am trying to set different colors of tasks in tree view based on stage: ie. blue for open tasks, green for completed tasks.

Open (id:1),
Completed (id:6),
Cancelled (id:7)

When i try this (just to check)

colors="blue:stage_id != 1

it turns every task blue including the Open tasks! So, I am not using the correct stage_id for this to work?

Here is the full xml:

<?xml version="1.0"?>
    <tree default_order="x_start_date asc" fonts="bold:message_unread==True" colors="blue:stage_id != 1;" string="Tasks">
        <field name="message_unread" invisible="1"/>
        <field name="sequence" invisible="not context.get('seq_visible', False)"/>
        <field name="name"/>
        <field name="project_id" invisible="context.get('user_invisible', False)" string="PO#"/>
        <field name="user_id" invisible="context.get('user_invisible', False)"/>
        <field name="delegated_user_id" invisible="context.get('show_delegated', True)"/>
        <field name="total_hours" invisible="1"/>
        <field name="planned_hours" invisible="context.get('set_visible',False)" groups="project.group_time_work_estimation_tasks"/>
        <field name="effective_hours" widget="float_time" sum="Spent Hours" invisible="1"/>
        <field name="remaining_hours" widget="float_time" sum="Remaining Hours" on_change="onchange_remaining(remaining_hours,planned_hours)" invisible="context.get('set_visible',False)" groups="project.group_time_work_estimation_tasks"/>
        <field name="date_deadline" invisible="context.get('deadline_visible',True)"/>
        <field name="stage_id" invisible="context.get('set_visible',False)" string="Task Status"/>

@anonymous: Well, i think i already have that in this line: Do i need to have any other field for this?

Zohair Iyaz
on 12/15/15, 10:15 PM

@Ray Carnes: I am using using V8 community version

Zohair Iyaz
on 12/15/15, 11:26 PM

Hello Zohair,

Please Make Sure to add field "id' in tree view (make invisible if not needed)


    <tree colors= "blue:stage_id != 1;"  string="Tasks">


on 12/15/15, 11:12 AM
Ray Carnes
On 12/15/15, 11:20 PM

For v9, colors are gone - replaced by the following decorators:

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

The formatting is dependent on the bootstrap style, and these can be combined (the colors look better when shown bold).

Thanks Ray, but what happens if i want to create my custom colors?

Noel Jesús Rivero
on 6/24/16, 5:57 PM

But Odoo's designers had a Color Summit and spent hours deciding those were the only colors that would look with the new design. You can't second guess them and start using your own!!! Why would you want your own colors? Why go against all of the planning and hard work to make sure Odoo looks great and will never clash with ill chosen color combinations? What you speak of is heracy. :)

Bista Solutions US, Ray Carnes
on 6/24/16, 6:02 PM

how to apply these colors in xml

on 10/24/17, 3:18 AM

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: 12/15/15, 6:53 AM
Seen: 3674 times
Last updated: 4/14/16, 9:02 AM