Odoo Help

3

0
2 Answers
5
Mustafa Kantawala India
2/2/15, 7:28 AM

Hello Dasadiya Chaitanya, In http.route() type describes which kind of operation do you want to perform.

Type = 'http' returns on another template and it will take dictionary with that. It will take you to the another template with the values and will refresh the page.

And type = 'json' calls from jsonrpc call from javascript and it will only return dictionary. It will not refresh the page and will do all the operation which is described in that method.

4

Hello Dasadiya Chaitanya,

type="json":

it will call JSONRPC as an argument to http.route() so here , there will be only JSON data be able to pass via JSONRPC, It will only accept json data object as argument.

type="http":

As compred to JSON, http will pass http request arguments to http.route() not json data.

Examples

@http.route('demo_html', type="http") // Work Pefrect when I call this URL

def some_html(self):

return "<h1>This is a test</h1>"

 

@http.route('demo_json', type="json") // Not working when I call this URL

def some_json(self):

return {"sample_dictionary": "This is a sample JSON dictionary"}

I hope it is useful to  you.

Ask a Question
Tag
Keep Informed
3 follower(s)
About This Community

This platform 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.

Register
Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now