Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
4103 Widoki

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? 

Awatar
Odrzuć
Najlepsza odpowiedź

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.

Awatar
Odrzuć
Autor

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. :)

Powiązane posty Odpowiedzi Widoki Czynność
2
maj 15
6046
1
cze 23
1926
1
lip 19
4497
1
cze 16
4695
0
cze 16
3887