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.