Chapter 9 - Odoo 15 Development Book


The Requests are used for communication between client and server. Mainly, there are three types of requests that are





HttpRequest communicates through the well-known GET and POST methods. That is

  • The client sends a request that is encoded in the URL (GET method), or the http body (HTTP body) (POST method)
  • The server responds with an item that matches the request.
  • It could be an HTML page, a PNG picture, a CSS file, JavaScript, or data encoded in XML.

When all we want to do is access a resource on the server, HTTP is simpler and easy to utilize.


def function(self, req, mods=None):
    //add button here


JsonRequest is an implementation of another protocol for client/server communication - JSON-RPC 2.0. You may want to take a look here for more information. It's a remote procedure call (RPC) protocol, which means it lets the client call a server method and send it some arguments. As a result of the method call, the client receives some data. JSON is better for executing server-side methods and obtaining results.


def formats(self, req):
    """ Returns all valid export formats
    :returns: for each export format, a pair of identifier and printable name
    :rtype: [(str, str)]
    //add button here


WebRequest is the Parent Class for every Odoo Web request type. We can see this class in the Odoo/ file.


Cr: Call is the method call's initializer.'It is a SQL construct that functions as a looping statement that retrieves data row by row. When the current request uses none authentication (auth=" none"), an exception is thrown.

Context: Mapping the current request's context values. The environment that is tied to the current request is referred to as Env.

Session: HTTP Session data provided by ERP session for the current HTTP session.

DB: The database is linked to the request.

If there is no authentication for the current request, it can be None. csrf token(time limit=None)-

It's a one-of-a-kind security token that prevents CSRF attacks. It returns a token string in ASCII.

time limit (int | None) specifies the validity of an iToken in seconds; the token will be valid for as long as the time limit (int | None) specifies.



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



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



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

Send Us A Message