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

Hello everyone, I try to get data when click an element. When I get result from RPC I need (if else) base on the result, here is my code 


and my debug console


Please give me some solutions , Thanks

Ảnh đại diện
Huỷ bỏ

see this :

https://www.cybrosys.com/blog/call-json-rpc-to-web-controller-in-odoo

Câu trả lời hay nhất

Hi,

Try like following

this._rpc({
model: this.fields[this.parent_name].relation,
method: 'search_read',
domain: [[this.parents_name, '=', recordId.id]],
fields: ['id', 'name'],
sort: "",
}).then((result) => {
if(result.length) {
// do somthing
} else {
// do somthing else
}
})

Regards

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 4 21
4431
0
thg 5 23
3208
1
thg 1 23
8020
2
thg 1 23
5321
0
thg 2 21
3480