Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
1 Rispondi
7468 Visualizzazioni

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
Abbandona

see this :

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

Risposta migliore

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
Abbandona
Post correlati Risposte Visualizzazioni Attività
2
apr 21
3999
0
mag 23
2720
1
gen 23
7506
2
gen 23
4836
0
feb 21
3183