Development Book V17: Http Route

HTTP routes are the pathways that connect user requests (URLs) to specific functions within an application like Odoo. They act as the traffic signals, directing each incoming request to the appropriate destination for processing and response.


    from odoo import http
    
    @http.route('/product', type='http', auth="user", website=True)

Within @http.route(), various parameters can be defined:

url: Specifies the URL to redirect to. In the given example, '/contacts' represents the URL.
type: Determines the operation type. Possible values are 'http' or 'json'. 'http' returns to the template, accepting the associated dictionary. 'json' invokes a JSON RPC from JavaScript.
auth: Defines access permissions for the specified URL:
auth='public': Allows unrestricted access to the URL.
auth='user': Permits access only to logged-in users.
auth='none': Remains active, primarily utilized by authentication modules.
website: Indicates whether the controller is linked to a web page. It accepts True or False as values.

whatsapp
location

Calicut

Cybrosys Technologies Pvt. Ltd.
Neospace, Kinfra Techno Park
Kakkancherry, Calicut
Kerala, India - 673635

location

Kochi

Cybrosys Technologies Pvt. Ltd.
1st Floor, Thapasya Building,
Infopark, Kakkanad,
Kochi, India - 682030.

location

Bangalore

Cybrosys Techno Solutions
The Estate, 8th Floor,
Dickenson Road,
Bangalore, India - 560042

Send Us A Message