Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
10419 มุมมอง
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

Related Posts ตอบกลับ มุมมอง กิจกรรม
1
มิ.ย. 25
2264
Controller not working แก้ไขแล้ว
2
มิ.ย. 25
594
3
มิ.ย. 24
3414
2
พ.ค. 24
2432
1
มี.ค. 23
3829