Odoo icon

Odoo

Consume Odoo API

Overview

This n8n node allows you to interact with custom resources in an Odoo instance via its API. Specifically, for the Custom Resource with the Action operation, the node enables you to trigger a specific server-side action on a chosen Odoo model (custom resource) by its ID and action name. This is useful when you want to automate or orchestrate business processes that are encapsulated as actions within your Odoo models.

Common scenarios:

  • Automating workflow steps that require triggering Odoo server actions (e.g., confirming orders, validating records, running custom scripts).
  • Integrating Odoo business logic into broader automation pipelines.
  • Remotely invoking custom methods defined in Odoo modules.

Example:
You have a custom Odoo model called x_my_custom_model and want to programmatically trigger an action named do_special_process on a record with ID 42 as part of an automated process.


Properties

Name Meaning
Custom Resource Name or ID Choose the Odoo model (custom resource) to operate on. You can select from a list or specify the technical model name using an expression.
Custom Resource ID The unique identifier of the record in the selected custom resource (model) on which the action will be performed.
Action to Perform The technical name of the action/method to execute on the specified record.

Output

The output will be a JSON object containing the result of the triggered action. The structure of this output depends on what the Odoo action returns. Typically, it may include:

  • Status or result fields as returned by the Odoo server action.
  • Any data or messages produced by the action.

If an error occurs and "Continue On Fail" is enabled, the output will contain an error field with the error message.

Example output:

{
  "result": "Action executed successfully",
  "data": {
    // ... any additional data returned by the Odoo action
  }
}

or, in case of error:

{
  "error": "Record not found"
}

Dependencies

  • Odoo Instance: You must have access to an Odoo server with the relevant custom model and action defined.
  • API Credentials: Requires valid Odoo API credentials (odooApi) configured in n8n, including URL, database name, username, and password.
  • n8n Configuration: No special environment variables beyond standard credential setup.

Troubleshooting

Common issues:

  • Invalid Model or Action Name: If the model or action name is incorrect, Odoo will return an error such as "Model not found" or "Method does not exist".
  • Missing Record: If the provided Custom Resource ID does not exist, you may receive an error like "Record not found".
  • Authentication Errors: Invalid credentials will prevent the node from connecting to Odoo; check your API credentials.
  • Insufficient Permissions: The Odoo user must have permission to perform the action on the specified model/record.

Error handling:

  • If "Continue On Fail" is enabled, errors are returned in the output under an error field.
  • Otherwise, the workflow execution will stop and display the error message.

Links and References


Discussion