Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
7268 Zobrazení

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
Zrušit

see this :

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

Nejlepší odpověď

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
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
2
dub 21
3835
0
kvě 23
2538
1
led 23
7277
2
led 23
4705
0
úno 21
3049