Tameson Odoo icon

Tameson Odoo

Consume Odoo API

Actions20

Overview

This node allows you to update a record in a custom Odoo resource (model) via the Odoo API. It is designed for scenarios where you need to programmatically modify fields of any custom model in your Odoo instance from within an n8n workflow. This is particularly useful for automating business processes, synchronizing data between systems, or updating records based on external triggers.

Example use cases:

  • Automatically update a custom sales order status when a payment is received.
  • Modify custom fields in a project management module based on workflow logic.
  • Integrate with other systems to keep Odoo custom resources up-to-date.

Properties

Name Type Meaning
Custom Resource Name or ID options Select the Odoo model (custom resource) to update. You can choose from a list or specify the model name using an expression.
Custom Resource ID string (required) The unique identifier of the record in the selected custom resource that you want to update.
Update Fields fixedCollection Specify one or more fields to update. Each entry lets you select a field (by name or ID) and provide its new value. You can add multiple fields to update several properties of the record in one operation.
  Field Name or ID options The specific field in the custom resource to update. Choose from a list or specify by ID/expression.
  New Value string The new value to assign to the specified field.

Output

The output is a JSON object representing the updated record as returned by the Odoo API. The structure of this object depends on the fields present in the custom resource and which fields are returned by Odoo after the update. Typically, it will include at least the record's ID and the updated fields.

Example output:

{
  "id": 123,
  "field1": "newValue1",
  "field2": "newValue2"
}

If the update fails and "Continue On Fail" is enabled, the output will contain an error property with the error message.

Dependencies

  • Odoo API: Requires access to an Odoo instance with the appropriate custom models configured.
  • API Credentials: You must set up Odoo API credentials (odooApi) in n8n, including URL, database name, username, and password.
  • n8n Configuration: No special environment variables beyond standard credential setup.

Troubleshooting

Common issues:

  • Invalid Credentials: If the Odoo API credentials are incorrect, authentication will fail. Error message: "Credentials are not valid" or "Settings are not valid: ..."
    • Resolution: Double-check the Odoo URL, database name, username, and password in your n8n credentials.
  • Incorrect Model or Field Names: If you specify a model or field that does not exist in Odoo, the update will fail.
    • Resolution: Use the dropdowns to select valid models/fields, or verify names/IDs in your Odoo instance.
  • Missing Required Fields: If required fields are omitted, Odoo may reject the update.
    • Resolution: Ensure all mandatory fields for the model are provided.
  • Record Not Found: If the provided Custom Resource ID does not exist, the update will fail.
    • Resolution: Confirm the record exists in Odoo before attempting to update.

Error handling:

  • If "Continue On Fail" is enabled, errors are returned in the output as { "error": "message" }.
  • Otherwise, the workflow execution will stop on error.

Links and References

Discussion