Reputation: 1137
<field name="Tr" attrs="{'readonly':['|',('week_end','=',False),('HSup_P1','!=',False),('HSup_P2','!=',False),('HSup_P3','!=',False),('HSup_P4','!=',False)]}"/>
What I want to do is to make this field readonly when week_end
is False or HSup_P1
, HSup_P2
, HSup_P3
or HSup_P4
are True.
Upvotes: 1
Views: 1308
Reputation: 10189
This should work:
<field name="Tr" attrs="{'readonly': ['|', '|', ('week_end', '=', False), ('HSup_P1', '!=', False), '|', '|', ('HSup_P2', '!=', False), ('HSup_P3', '!=', False), ('HSup_P4', '!=', False)]}"/>
Take a look at my answer in this post: I don´t understand Normal Polish Notation (NPN or PN). How to build a complex domain in Odoo?
I think it will help you in the future when you have to deal with domains and this Polish Notation.
So if you apply the method I suggest you in the link:
A => ('week_end', '=', False)
B => ('HSup_P1', '!=', False)
C => ('HSup_P2', '!=', False)
D => ('HSup_P3', '!=', False)
E => ('HSup_P4', '!=', False)
What you want:
Step 0. => A or B or C or D or E
Here you can group the letters as you want, since there aren't any priorities, so for example:
Step 1. => A or B or C or D or E
Step 2. => AB or C or D or E
Step 3. => AB or CD or E
Step 4. => AB or CDE
Now, we decompose the made groups, moving their operators to the left side:
Step 4. => or AB CDE
Step 3. => or AB or CD E
Step 2. => or AB or or C D E
Step 1. => or or A B or or C D E
Finally, replace the letters by their respective expressions and the operators too (or
by |
, and
by &
), and you'll get the answer I wrote you above.
Upvotes: 3