コンテンツへスキップ
メニュー
この質問にフラグが付けられました
6 返信
6749 ビュー

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!

アバター
破棄
最善の回答

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 '<>')

著作者

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

著作者

It works, thanks!

関連投稿 返信 ビュー 活動
7
5月 20
6336
0
4月 16
2997
2
10月 15
21302
2
4月 15
5897
0
3月 15
3389