İçereği Atla
Menü
Bu soru işaretlendi
1 Cevapla
4108 Görünümler

I would like to "mute" the qty field on pos.order form for predetermined products starting with (or containing) the char '#'.

<field name="qty" on_change="onchange_qty(product_id, discount, qty, price_unit, context)"  attrs="{'invisible':[('product_id',whathere?,'#')]}"/> 

What should be the correct syntax for attrs? Is there any problem using this parameter with on_change? 

Avatar
Vazgeç
En İyi Yanıt

Hi,

you need to define your field as like below.

<field name="qty" on_change="onchange_qty(product_id, discount, qty, price_unit, context)"
attrs="{'invisible':[('product_id.name','ilike','#')]}" />

When product name is containing "#" at that time "qty" field will be invisible.

Avatar
Vazgeç
Üretici

No. It doesn't work with 'product_id.name': Uncaught Error: Unknown field product_id.name in domain [["product_id.name","ilike","#"]]. Please note the -1 is not mine. :)

İlgili Gönderiler Cevaplar Görünümler Aktivite
2
May 15
6047
1
Haz 23
1927
1
Tem 19
4499
1
Haz 16
4696
0
Haz 16
3887