Skip to Content
Odoo Menu
  • Sign in
  • Try it free
  • Apps
    Finance
    • Accounting
    • Invoicing
    • Expenses
    • Spreadsheet (BI)
    • Documents
    • Sign
    Sales
    • CRM
    • Sales
    • POS Shop
    • POS Restaurant
    • Subscriptions
    • Rental
    Websites
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventory
    • Manufacturing
    • PLM
    • Purchase
    • Maintenance
    • Quality
    Human Resources
    • Employees
    • Recruitment
    • Time Off
    • Appraisals
    • Referrals
    • Fleet
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Events
    • Marketing Automation
    • Surveys
    Services
    • Project
    • Timesheets
    • Field Service
    • Helpdesk
    • Planning
    • Appointments
    Productivity
    • Discuss
    • Approvals
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage Distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Estate Management
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Manufacturing
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Community
    Learn
    • Tutorials
    • Documentation
    • Certifications
    • Training
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Download
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Events
    • Translations
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Pricing
  • Help

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Accounting
  • Inventory
  • PoS
  • Project
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
Help

Set color in Tree view based on "task stage"

Subscribe

Get notified when there's activity on this post

This question has been flagged
odooV8
9 Replies
17993 Views
Avatar
Zohair Iyaz

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>

0
Avatar
Discard
Zohair Iyaz
Author

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

Zohair Iyaz
Author

@Ray Carnes: I am using using V8 community version

Jusab Sida (jsi)

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

Avatar
Ray Carnes
Best Answer

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

7
Avatar
Discard
Noel Jesús Rivero

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

Ray Carnes

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

Nitin Nath Giri

how to apply these colors in xml

Noel Jesús Rivero

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.

Avatar
Sarender Reddy
Best Answer

Use below code in xml file.


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

0
Avatar
Discard
Avatar
kazunobu ndong
Best Answer

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

0
Avatar
Discard
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Sign up
Related Posts Replies Views Activity
How to perform partial reconciliation on journal items and reconcile only part of the amount?
odooV8
Avatar
0
Dec 25
11
ENTREPRISE V18-Automatic draft Delivery Notes on Sales Orders causing sequence gaps and date inconsistencies
odooV8
Avatar
0
Dec 25
28
List view -export -data- how to schedule and send by Email - Odoo V17
odooV8
Avatar
0
Dec 25
11
CONFIGURACION DE CORREO PROPIO POR PRUMERA VEZ
odooV8
Avatar
0
Mar 25
2211
How to remove model if not in the py files anymore
odooV8
Avatar
0
Jan 25
4559
Community
  • Tutorials
  • Documentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Translations
Services
  • Odoo.sh Hosting
  • Support
  • Upgrade
  • Custom Developments
  • Education
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Brand Assets
  • Contact us
  • Jobs
  • Events
  • Podcast
  • Blog
  • Customers
  • Legal • Privacy
  • Security
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now