ADO.NET Provider for Odoo

Build 26.0.9655

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 provider provides 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 are provided as a JSON array; and the keyword arguments are provided as an object.

The provider takes the result of the RPC and converts it back into JSON for the procedure output.

Note: The JSON-2 API is only available in Odoo version 19 and later. Unlike XML-RPC, the JSON-2 API does not support the Arguments parameter; if Arguments is specified when using the JSON-2 API, the procedure returns an error. All parameters must be provided through KeywordArgs as a JSON object.

XML-RPC Example

Say you wanted to 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"]}'

JSON-2 API Example (Odoo 19+)

This example shows the same 'read' call on 'hr.employee', but using the JSON-2 API. Since Arguments is not supported, all parameters including the record IDs must be passed through KeywordArgs:

EXECUTE CallProcedure
  Model = 'hr.employee',
  Operation = 'read',
  KeywordArgs = '{"domain": ["id", "in", [2,4]], "fields": ["department_id", "name"]}'

Calling this procedure on the Odoo sample data returns 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. This column is not supported in Odoo version 19 and above.
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.

Copyright (c) 2026 CData Software, Inc. - All rights reserved.
Build 26.0.9655