Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
6 ตอบกลับ
6781 มุมมอง

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!

Related Posts ตอบกลับ มุมมอง กิจกรรม
7
พ.ค. 20
6428
0
เม.ย. 16
3084
Display fields of other model in a view แก้ไขแล้ว
2
ต.ค. 15
21335
2
เม.ย. 15
5980
0
มี.ค. 15
3418