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.


[IMP][FEATURE]How to style conditionnaly some fields in forms / Qweb in forms

Mind And Go
on 7/8/15, 10:54 AM 753 views

Hi everyone,

I've been looking for the best way to use Qweb in forms views because it seems to be the answer to my problem. Unfortunately, IRC and the forum seems to be agree on the fact that it's not possible in form view. So here is a wish!

Anyway, I need a work around for this styling part. I would like to color a field (membership_state) thanks to style, css or whatever regarding to its value.

Any advice would be appreciated.


Here are some ideas: 1- Declare your field with a class attribute with your css class name. Then in a css style the field as you need 2- (if #1 doesn't work) Declare your field inside a div and add a class to the div with your css class name. Then in a css style the field inside the div as you need 3- if nothing above works then you need to extends the used widget in javascript to process an option that have the color that you need to apply or the class for the field style. Use include to replace normally the start function.

Axel Mendoza
on 7/14/15, 3:56 AM

Hy @Axel, thanks for the answer, actually it wasn't reaaly what I'm looking for. Styling through css the field with class attribute works well but my point is to **conditionnaly** style the object. In the end, I think I'll have to do some fileds_view_get. regards

Mind & Go, Mind And Go
on 7/14/15, 4:14 AM
Mind And Go
On 7/19/15, 6:30 AM

I think it could be consider as a feature request : https://github.com/odoo/odoo/issues/7526

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: 7/8/15, 10:54 AM
Seen: 753 times
Last updated: 7/19/15, 6:31 AM