Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
4124 Lượt xem

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? 

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhấ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.

Ảnh đại diện
Huỷ bỏ
Tác giả

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

Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 5 15
6054
1
thg 6 23
1934
1
thg 7 19
4503
1
thg 6 16
4698
0
thg 6 16
3890