Odoo Help


Why operator != not works?

on 3/13/15, 8:40 AM 849 views

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!

On 3/13/15, 8:55 AM

try to use <> instead of !=


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

-the equivalent code with "not in" operator

Not works (I try '<>')

on 3/13/15, 9:01 AM

With special caracters

on 3/13/15, 9:03 AM

is XYZ a really string like 'XYZ' ?

on 3/13/15, 9:04 AM

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

on 3/13/15, 9:13 AM

It works, thanks!

on 3/13/15, 9:23 AM

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

2 follower(s)


Asked: 3/13/15, 8:40 AM
Seen: 849 times
Last updated: 3/27/15, 6:42 PM