Odoo Help

0

Set color in Tree view based on "task stage"

By
Zohair Iyaz
on 12/15/15, 6:53 AM 2,917 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--
17170
| 9 7 9
Atlanta, United States
--Ray Carnes--

Senior Odoo Analyst

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

Completed Odoo Functional and Technical Training.

Major Skills:

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

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

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.

Register

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)

Stats

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