跳至內容
選單
此問題已被標幟
1 回覆
7270 瀏覽次數

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

頭像
捨棄

see this :

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

最佳答案

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

頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
2
4月 21
3835
0
5月 23
2538
1
1月 23
7277
2
1月 23
4706
0
2月 21
3053