CallProcedure
Calls a server-side RPC within Odoo.
Procedure-Specific Information
Odoo exposes its RPCs using the External API. This API uses an XML-RPC method called execute_kw to call Odoo procedures on specific modules. Internally the method looks like this:execute_kw(database, user_id, password, model, operation, arguments, keyword_args)
The driver will provide the connection information automatically, so the only parameters required for CallProcedure are the model, the operation, a list of arguments and a map of keyword arguments. The arguments and keyword arguments are provided as a JSON array and object respectively. The driver will take the result of the RPC and convert it back into JSON for the procedure output.
For example, you could call the 'read' method on the 'hr.employee' model to read information about specific employees. In this case you would retrieve the name and department for the employees with the IDs 2 and 4:
EXECUTE CallProcedure Model = 'hr.employee', Operation = 'read', -- The read RPC takes one argument, which is the list of IDs Arguments = '[[4, 2]]', KeywordArgs = '{"fields": ["department_id", "name"]}'
Calling this procedure on the Odoo sample data will return this JSON result:
[ {"department_id": [4, "Research & Development"], "id": 4, "name": "Sharlene Rhodes"}, {"department_id": [4, "Research & Development"], "id": 2, "name": "Ronnie Hart"} ]
Input
Name | Type | Description |
Model | String | The model to execute the procedure on. |
Operation | String | The procedure to execute. |
Arguments | String | The list of arguments to pass to the RPC, formatted as a JSON list |
KeywordArgs | String | The keyword arguments to pass to the RPC, formatted as a JSON object |
Result Set Columns
Name | Type | Description |
JSON | String | The output of the RPC converted to JSON. |