Skip to Content
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odgovori
7330 Prikazi

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
Opusti

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
Opusti
Related Posts Odgovori Prikazi Aktivnost
2
apr. 21
3912
0
maj 23
2610
1
jan. 23
7364
2
jan. 23
4761
0
feb. 21
3100