Skip to Content
Menu
This question has been flagged
2 Replies
9456 Views
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




Avatar
Discard
Best Answer

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


Avatar
Discard
Author

thank you.

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

Related Posts Replies Views Activity
3
Jun 24
1832
2
May 24
1049
0
Apr 24
550
1
Mar 23
1960
0
Feb 23
1268