콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
5 답글
18475 화면

rpc.query isn't working in my end.

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


Thanks in advance.

아바타
취소
베스트 답변


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):
     ...


아바타
취소
작성자

Thanks Hilar Ak,

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

check your code, this is a correct format.

베스트 답변

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.



아바타
취소
베스트 답변

@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)

아바타
취소
관련 게시물 답글 화면 활동
0
8월 21
162
0
3월 15
3456
0
3월 15
3390
0
3월 15
3878
1
4월 24
1637