Odoo Help
Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM
|
e-Commerce
|
Accounting
|
Inventory
|
PoS
|
Project management
|
MRP
|
etc.
how to use & and | in attrs
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
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':['|','&',('a','=',True),('state','=','done'),'&',('a','=',False),('state','=','available')]}"/>
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:
['|','&',('a','=',True),('state','=','done'),'&',('a','=',False),('state','=','available')]
in xml (see @Temur post)
['|','&',('a','=',True),('state','=','done'),'&',('a','=',False),('state','=','available')]
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.
RegisterOdoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.
Test it nowQuestion tools
Stats
Asked: 7/6/15, 4:24 AM |
Seen: 1135 times |
Last updated: 7/7/15, 9:21 PM |