Odoo Help


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.


[7.0] Field / widget : type = color ?

Sylvain LE GAL
on 11/12/13, 8:45 PM 2,089 views


I need a field to select a color. I would know if there is a widget="color" to pickup a color.

I searched, but I didn't find in the framework. (I'm using 7.0 serie)

Thanks for your answer.

Sylvain LE GAL
On 11/13/13, 9:44 AM

Thanks !

Good feature, I didn't know. But it wasn't what I was looking. I was looking for :

  • a widget in a simple view form (no kanban, but it's ok) ;
  • the possibility to choose any color (that feature doesn't allow that) ;

For your information, to do what Mariusz Mizgier said :

  • In the python file (like in project/project.py) :

    _columns = { 'my_color_field': fields.integer('My Color Field'),}

  • In the kanban view (like in project/project_view.xml) :

    <ul class="oe_kanban_colorpicker" data-field="my_color_field"/>

It's possible to pickup 10 different colors defined in the two following files :

  • openerp-web/addons/web_kanban/static/src/js/kanban.js

number_of_color_schemes = 10

  • openerp-web/addons/web_kanban/static/src/css/kanban.css

.openerp .oe_kanban_view .oe_kanban_color_0 {background-color: white;}

.openerp .oe_kanban_view .oe_kanban_color_9 {background-color: #ffc7f1;}

Mariusz Mizgier
On 11/13/13, 3:05 AM

You should refer to class oe_kanban_colorpicker with table column color of type integer. You could easily trace how does it work using project kanban view.

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)


Asked: 11/12/13, 8:45 PM
Seen: 2089 times
Last updated: 3/16/15, 8:10 AM