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.

2

How to set a conditional style for a field?

By
Juan Formoso
on 11/12/14, 4:58 AM 569 views

I'd like to set a style to a field depending on the value of other field.

For example:

I have a field name (string) and a field is_company (boolean). If is_company is True, I want to set the width of the field name to 100%. If not, the width must be 48%.

If is_company:

<field name="name" placeholder='Name' />

else:

<field name="name" placeholder='Name' class='oe_inline' style='margin-right: 2%%; max-width: 48%% !important;' />

The only conditional kind of style I found by the moment is the color:

< ... colors="green: is_company == True;">

But now, this is not what I'm looking for.

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

2 follower(s)

Stats

Asked: 11/12/14, 4:58 AM
Seen: 569 times
Last updated: 3/16/15, 8:10 AM