Skip to Content
Menú
This question has been flagged
6 Respostes
6704 Vistes

Hello, I have Odoo 8. I want to show a field only if the value of another field is XYZ. My xml definition is:

<field name="fecha" attrs="{'invisible':[('nombre_cliente', '!=', 'XYZ')]}" />

In this case, the field is invisible if the 'nombre_cliente' is XYZ or if it is another value.

If I put: <field name="fecha" attrs="{'invisible':[('nombre_cliente', '=', 'XYZ')]}" /> it works fine because if the name is XYZ the field is invisible and in another cases the field is visible.

What is my mistake? Thanks!

Avatar
Descartar
Best Answer

try to use <> instead of !=

OR

<field name="fecha" attrs="{'invisible':[('nombre_cliente', 'not in', [ 'XYZ' ])]}" />

-the equivalent code with "not in" operator

Avatar
Descartar
Autor

Not works (I try '<>')

Autor

With special caracters

is XYZ a really string like 'XYZ' ?

I updated answer and added another option of equivalent code, if problem in != operator replacing it with equivalent code may help. please try second one with "not in" and pay attention that in this case you've to wrap XYZ in Square Brackets [ ]...

Autor

It works, thanks!

Related Posts Respostes Vistes Activitat
7
de maig 20
6271
0
d’abr. 16
2965
2
d’oct. 15
21249
2
d’abr. 15
5811
0
de març 15
3322