odoo.http.route

The route decorator allows us to tell Odoo that a method should be web accessible in the first place, and the first parameter determines on which path it is accessible. Instead of a string, you can also pass a list of strings, in case you use the same function to serve multiple paths.

The type argument defaults to http and determines what type of request is to be served. While strictly speaking, JSON is HTTP, declaring the second function as type='json' makes life a lot easier, because Odoo then handles type conversions for us.

Don't worry about the auth parameter for now; it will be addressed in the Restricting access to web accessible paths recipe in this chapter.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset