Odoo Help

Welcome!

This community 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.

0

Why operator != not works?

By
José
on 3/13/15, 8:40 AM 596 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!

1

Temur

--Temur--
2894
| 6 5 7
Tbilisi, Georgia
--Temur--
Programmer
Temur
On 3/13/15, 8:55 AM

try to use <> instead of !=

OR

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

-the equivalent code with "not in" operator

Not works (I try '<>')

José
on 3/13/15, 9:01 AM

With special caracters

José
on 3/13/15, 9:03 AM

is XYZ a really string like 'XYZ' ?

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

Temur
on 3/13/15, 9:13 AM

It works, thanks!

José
on 3/13/15, 9:23 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

2 follower(s)

Stats

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