Community mailing list archives

Python Function call from JS

- 02/27/2016 06:33:07
Hi Guys,

I have an onclick being called in qweb template, and then this onclick calls a js function which inturn calls a python function in my controller. But I am getting an error as follows when I am trying to do so.

TypeError: openerp.jsonRpc is not a function

The code in the js function is as follows:

function Print() {

var website =;
var currentLocation = window.location;
var returnurl=openerp.jsonRpc('/print', 'call', {});
alert('You have signed out!');

And the controller function is as follows:

class print(http.Controller):

    @http.route('/print', type='json', auth="public")
    def project_signout(self):
        employee_obj = request.registry.get('hr.employee')
        employee_id =, request.session.uid, [('user_id', '=', request.session.uid)], context=request.context)
        return True

Does anyone have an idea regarding what I am doing wrong over here?

Thanks And Regards,
Yaseen Shareef

Odoo Developer/ Consultant
Skype: yaseen.shareef91