Odoo Help

Welcome!

This community 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.

0

Set color in Tree view based on "task stage"

By
Zohair Iyaz
on 12/15/15, 6:53 AM 1,921 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.

Stages:
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"/>
 </tree>

@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)

Example:

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

Thanks

Swapnesh
on 12/15/15, 11:12 AM
6

Ray Carnes

--Ray Carnes--
15677
| 9 7 9
Greater Los Angeles, United States
--Ray Carnes--

Senior Odoo Analyst

OpenERP 6.1, 7.0 and Odoo 8.0, 9.0 (Since 2012)

Completed Functional and Technical Training.

Major Skills:

  • Needs Discovery and Requirements Analysis;

  • Function and Technical Specifications;

  • Project Planning;

  • Prototyping and Proof of concepts;

  • Data migration;

  • Configuration & Customization (UI and modules);

  • Integration - data, business logic and service levels;

  • Training and Knowledge transfer;

  • Go Live support;

  • Help desk;

  • Version Migration.

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. 

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

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 community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 12/15/15, 6:53 AM
Seen: 1921 times
Last updated: 4/14/16, 9:02 AM