Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda

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

Avatar
Buang

see this :

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

Jawaban Terbai

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

Avatar
Buang
Post Terkait Replies Tampilan Aktivitas
2
Apr 21
3818
0
Mei 23
2505
1
Jan 23
7240
2
Jan 23
4679
0
Feb 21
2998