콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
2 답글
10420 화면
this is my py file
@http.route('/some/route/'website=Truetype='json'auth='public'csrf=False)
    def get_data(self, **kw):
        condition = kw['some']
        sql = """
            select name from res_partner where phone = '%s' or email = '%s'
        """ % (condition)
        http.request.cr.execute(sql)
        result = http.request.cr.fetchall() or []
        data = []
        list(data)
        for x in result:
            temp = ''.join(x)
            data.append(temp)
        print(data)
        return http.request.render("custom_search.get_data", {
            'data': data
        })

js file
    rpc.query({
        route: '/some/route/',
        params: { some: search.Input }
    })


i have error 'JsonRequest' object has no attribute 'render'

i try send request by ajax but it not auto redirect to /some/route
can i get any solution to render xml template like httprequest




아바타
취소
베스트 답변

Not really sure but try following code instead of http.request.render:

return http.request.env['ir.ui.view'].render_template("custom_search.get_data", {'data': data})


아바타
취소
작성자

thank you.

it return template but it not auto redirect page /some/route

관련 게시물 답글 화면 활동
1
6월 25
2264
2
6월 25
595
3
6월 24
3416
2
5월 24
2433
1
3월 23
3831