This section provides a brief overview of the main objects the API provides.
The starting point for communicating with the OpenERP server is the Session class. The session class holds session credentials and the context object. It provides the 'executeCommand' method used by other classes to communicate with the server.
The two main classes used to communicate with the OpenERP server are:
1. ObjectAdapter
2. OpenERPCommand
The Object Adapter class is the preferred way of communicating with the OpenERP server. It does error checking on filters and data, converts data types, formats values and wraps OpenERP responses into RowCollection objects.
The OpenERPCommand class wraps around the basic OpenERP commands. It does no validation, error checking or conversions. If you find the ObjectAdapter too restrictive in its validation, you can go back to the OpenERPCommand object (but please also raise a ticket to get it fixed). See the Conversion Considerations section on this page for a couple of type conversion hints.
If you find that the ObjectAdapter and OpenERPCommand classes don't wrap around the function you want to use, you can call the 'executeCommand' function on the Session object.
If you do make use of the OpenERPCommand or Session object to communicate with the server, the following needs to be taken into account. Python dictionaries map to Java HashMap objects and Python lists map to Object[]. OpenERP does not support extended XMLRPC types (ie floats etc, you have to use doubles) and null values map to the boolean 'false' (sending and receiving). Each function may also have different requirements, for example the import_data function requires that many2many values are a comma separated list of object names (yes, names not ids). See the OpenERP website for how many2many fields are handled when using the create/write functions (remembering that lists are Object[]).
Unless the call is very simple or you are forced to use the other classes, the ObjectAdapter is the suggested method of communicating with the server. It takes all conversion considerations into account.