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.


Attrs multiple condition. Boolean AND.

on 5/22/13, 9:56 AM 7,905 views

Hello, how I can define multiple conditions in attrs of a field? I need hide field_name_3 when field_name_1 AND field_name_2 are empty. I'm trying to use following condition:

<field name="field_name_3" attrs="{'invisible':[('filed_name_1','=',False),('fieled_name_2','=',False)]}"/>

But it works like the OR.

Clément THOMAS
On 5/22/13, 10:02 AM

I think with this syntax it works like AND condition behaviour.

If you want to specify OR condition you must use this syntax :


Thanks, I need to use OR.

on 5/22/13, 10:26 AM
Dr Obx
On 2/15/16, 6:04 AM

  attrs="{'invisible':['|',('filed_name_1','=',False),('fieled_name_2','=',False)]}"   for OR

  attrs="{'invisible':['&',('filed_name_1','=',False),('fieled_name_2','=',False)]}"  for AND

<field name="name" attrs="{'invisible': [('condition1', '=', False)], 'required': [('condition2', '=', True)]}"/><!-- as default it works as AND without any additional '|' or '&'-->

You can use more than two conditions, then you should use '|','|','&' depending on conditions order and what you want to achieve.
for example attrs="{'invisible': [('product_lines_id','!=','Computer'),('product_lines_id','!=','Server')],'required':[

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: 5/22/13, 9:56 AM
Seen: 7905 times
Last updated: 2/15/16, 6:04 AM