Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
6 Antwoorden
6711 Weergaven

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
Annuleer
Beste antwoord

try to use <> instead of !=

OR

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

-the equivalent code with "not in" operator

Avatar
Annuleer
Auteur

Not works (I try '<>')

Auteur

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 [ ]...

Auteur

It works, thanks!

Gerelateerde posts Antwoorden Weergaven Activiteit
7
mei 20
6277
0
apr. 16
2968
2
okt. 15
21269
2
apr. 15
5819
0
mrt. 15
3330