Skip to Content
Menu
This question has been flagged
1 Atsakyti
7775 Rodiniai

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

Portretas
Atmesti

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

Portretas
Atmesti
Related Posts Replies Rodiniai Veikla
2
bal. 21
4258
0
geg. 23
3051
1
saus. 23
7844
2
saus. 23
5152
0
vas. 21
3336