Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
7251 Vistas

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
Descartar

see this :

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

Mejor respuesta

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
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
2
abr 21
3826
0
may 23
2525
1
ene 23
7261
2
ene 23
4692
0
feb 21
3013