Odoo Help


how to use & and | in attrs

willie ho
on 7/6/15, 4:24 AM 956 views

i need to make a attrs to a button when ((a = true and state = done) or (a= false and state = available)

what should i put in the button to make it works?

i tried

<button name = "button_a" string ="Button A" attrs="{'invisible':[('&',('a','=',True),('state','=','done')),('&',('a','=',False),('state','=','available'))]}"/>

and it says there is error 

On 7/6/15, 4:53 AM

actually you've two errors:

1. you can't use special character & in XML directly, you should write it with it's xml code (we discussed it here)

2. conditional statement is not a valid prefix notation statement, you should write the statement in the prefix notation (we discussed it here)

correct the two errors and you're done:

<button name = "button_a" string ="Button A" attrs="{'invisible':['|','&amp;',('a','=',True),('state','=','done'),'&amp;',('a','=',False),('state','=','available')]}"/> 
Anil R. Kesariya
On 7/6/15, 4:50 AM


Here you go!

By default & Operator applied so no need to use & operator

<button name = "button_a" string ="Button A" attrs="{'invisible':['|', '&',('a','=',True),('state','=','done'),'&',('a','=',False),('state','=','available')]}"/> 

Hope, This will help you



On 7/6/15, 5:04 AM

Use the Polish notation

About your question:

(A and B) or (C and D) 

should converted to the polish notation as

or and A B and C D

in your example:


in xml (see @Temur post)


About This Community

This platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 7/6/15, 4:24 AM
Seen: 956 times
Last updated: 7/7/15, 9:21 PM