CallProcedure
Executes a server-side Remote Procedure Call (RPC) within the Odoo framework, allowing seamless interaction with business logic components such as models, workflows, and services. Typically, it triggers automated processes or retrieves computed data from the backend.
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 add-in 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 add-in 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 | Specifies the name of the Odoo model, such as res.partner or sale.order, for executing the Remote Procedure Call (RPC). This enables targeting specific data structures within the Odoo system. |
| Operation | String | Defines the name of the operation or method to be executed on the given model. This typically corresponds to a method defined in the model's Python class, representing actions such as 'create', 'write', or custom business logic. |
| Arguments | String | A list of positional arguments to pass to the specified operation. This should be formatted as a JSON list, which can include values like record IDs, simple data values, or nested structures required by the RPC. |
| KeywordArgs | String | A dictionary of named arguments passed to the operation, formatted as a JSON object. This allows for more explicit parameter passing and can include options, such as context values, field updates, or flags controlling execution behavior. |
Result Set Columns
| Name | Type | Description |
| JSON | String | The complete output returned by the remote procedure call, serialized into JSON format. This output can include created record IDs, result data, or structured error messages depending on the operation invoked. |