Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
5 Trả lời
18354 Lượt xem

rpc.query isn't working in my end.

I wanna call the function in wizard model through button inside wizard.


Thanks in advance.

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất


var rpc = require('web.rpc')

rpc.query(

     model: //your model,

     method: //your method,

      args: [{

          'arg1': value1,

      }]

 }).then(function (result) { 

            // your code 

  });

on model.py

@api.model
def your_method(self):
     ...


Ảnh đại diện
Huỷ bỏ
Tác giả

Thanks Hilar Ak,

I already tried like that but I got server application error.:'(

check your code, this is a correct format.

Câu trả lời hay nhất

Hello Merida,

You can use "this._rpc()" method to call python function from javascript.

You can find plenty of references in base addons for the same.

Thanks.



Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

@Merida: I don't know if you managed to get it working, but I had a simular problem that magically fixed itself when I restarted Odoo (or the docker container I'm running it in)

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 8 21
162
0
thg 3 15
3368
0
thg 3 15
3312
0
thg 3 15
3753
1
thg 4 24
1519