Introducing the OdooRPC library
Another relevant client library to be considered is OdooRPC. It is a more modern client library that uses the JSON-RPC protocol instead of XML-RPC. The fact is that the Odoo official web client uses JSON-RPC, and the original XML-RPC is supported mostly for backward compatibility.
OdooRPC is now under the Odoo Community Association umbrella and is being actively maintained. You can learn more about it at https://github.com/OCA/odoorpc.
The way the Odoo API is used is not very different whether you are using JSON-RPC or XML-RPC. So, you will see that, while some details differ, the way these different client libraries are used is not very different.
OdooRPC sets up a server connection when a new odoorpc.ODOO
object is created, and we should then use the ODOO.login()
method to create a user session. Just like on the server side, the session has an env
attribute with the session's environment, including the user ID, uid
, and the context
.
We can use OdooRPC to provide...