Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

/web/webclient/version_info: Function declared as capable of handling request of type 'json' but called with a request of type 'http'

By
Anand
on 4/19/16, 6:42 AM 655 views

When i make a call to this url from https://github.com/akretion/angular-odoo/blob/master/dist/odoo.js lib i get above error. Please help me to solve this. i am using odoo 9.

0

Pawan

--Pawan--
1267
| 4 3 5
Hyderabad, India
--Pawan--


Pawan
On 4/19/16, 8:28 AM

Anand,

I too got this issue while making an ajax request to the controller.

Please try making

type:'POST',  in your .js ajax request

and in controller decorater it should be something like...

@http.route('/pproject/get_po_prices', methods=['POST'], type='json', auth="public", website=True)

then you can access your data using

data = request.jsonrequest

under yourcontroller

Hope it helps!    


Hi, @http.route('/web/webclient/version_info', type='json', auth="none") def version_info(self): return openerp.service.common.exp_version() This is the controller am calling.. This is Ajax call am using $(document).ready(function(){ $("button").click(function(){ $.ajax({url: "https://www.nomado.eu/web/webclient/version_info", success: function(result){ console.log(result); $("#div1").html(result); }}); }); }); But it gives me XMLHttpRequest cannot load https://www.nomado.eu/web/webclient/version_info. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '192.0.12.34' is therefore not allowed access. The response had HTTP status code 400. How to solve this.. please update

Anand
on 4/19/16, 9:37 AM
0

Prakash Sharma

--Prakash Sharma--
815
| 2 1 4
Delhi, India
--Prakash Sharma--

I like to surround myself with brave, creative people.

My motivation for learning different technologies and algos drive me. I love challenges of a steep learning curve which I believe makes me a better learner. I have a strong desire to learn different technologies, which would enable me to become a full stack developer.

Prakash Sharma
On 4/19/16, 7:51 AM

the controller  @http.route('/web/webclient/version_info', type='json', auth="none")  you are calling have type='json', so just call it using jsonrpc, instead of http .

Please post the code you have done so far ,than only  we can help you.

Hi, @http.route('/web/webclient/version_info', type='json', auth="none") def version_info(self): return openerp.service.common.exp_version() This is the controller am calling.. This is Ajax call am using $(document).ready(function(){ $("button").click(function(){ $.ajax({url: "https://www.nomado.eu/web/webclient/version_info", success: function(result){ console.log(result); $("#div1").html(result); }}); }); }); But it gives me XMLHttpRequest cannot load https://www.nomado.eu/web/webclient/version_info. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '192.0.12.34' is therefore not allowed access. The response had HTTP status code 400. How to solve this.. please update

Anand
on 4/19/16, 9:38 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 4/19/16, 6:42 AM
Seen: 655 times
Last updated: 4/19/16, 8:28 AM