Odoo Help


Set color in Tree view based on "task stage"

Zohair Iyaz
on 12/15/15, 6:53 AM 4,816 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

--Ray Carnes--
| 9 7 9
Keyport, United States
--Ray Carnes--

Senior ERP Analyst

OpenERP 6.1, 7.0; Odoo 8.0, 9.0, 10.0 and 11.0.

Completed Odoo Functional and Technical Training.

Functional Areas:

  • CRM/Sales

  • Inventory

  • Manufacturing

  • Accounting

  • Purchasing

Major Skills:

  • Business Process Reengineering

  • Efficiency Consulting

  • User Needs and GAP Analysis;

  • Functional and Technical Design;

  • Prototyping and Proof of Concepts;

  • Requirements Specifications;

  • Agile Implementation;

  • Data Migration;

  • Configuration & Customization (UI and code);

  • Integration - Odoo and non Odoo Applications and Services;

  • Training and Knowledge Transfer;

  • Go Live Support;

  • Helpdesk;

  • Version Upgrades and Migration.

  • Accounting Expert.

I have over 20 years of experience empowering and enabling users with enterprise information systems that make a real and measurable difference in their ability to proactively manage their businesses and organizations. 

I am a skilled Communicator and I only take the serious things seriously!

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. :)

Ray Carnes
on 6/24/16, 6:02 PM

how to apply these colors in xml

on 10/24/17, 3:18 AM

Sorry my late answer Ray, it is not heresy, lol, the thing is i also used Odoo as a framework, and there are business objects where i need a lot of color to differentiate the different stages, and here i just have a few options, just 6, grr, i have a business object that goes through 8 stages.

Noel Jesús Rivero
on 1/4/18, 11:31 PM
Sarender Reddy
On 12/6/17, 4:10 AM

Use below code in xml file.

     <tree string = "Idea Junction" decoration-info="state=='open'" decoration-muted="state == 'rejected'" decoration-danger="state == 'close'" >

kazunobu ndong
On 11/28/17, 9:22 PM

Did you find out why everything is turning blue???

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: 4816 times
Last updated: 12/6/17, 4:10 AM