Skip to Content
Menu
This question has been flagged

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
Discard

see this :

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

Best Answer

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
Discard
Related Posts Replies Views Activity
2
Apr 21
3816
0
May 23
2500
1
Jan 23
7233
2
Jan 23
4678
0
Feb 21
2998