Actions20
Overview
This node allows you to create a new record in a custom Odoo resource (model) via the Odoo API. It is designed for scenarios where you need to automate the creation of records in any custom model within your Odoo instance, such as adding entries to custom tables or modules that are not covered by standard resources like Contacts or Opportunities.
Common use cases:
- Automating data entry into custom Odoo models from other systems.
- Integrating external forms or applications with custom Odoo modules.
- Bulk-creating records in custom resources based on incoming data streams.
Example:
Suppose you have a custom Odoo model for managing equipment inventory. You can use this node to automatically add new equipment records whenever new items are registered in another system.
Properties
| Name | Type | Meaning |
|---|---|---|
| Custom Resource Name or ID | options | Select the target custom Odoo model (resource) from a list, or specify its technical name/ID using an expression. This determines which Odoo model the record will be created in. |
| Fields | fixedCollection | Specify one or more fields and their values to set on the new record. Each field entry includes: - Field Name or ID: The technical name/ID of the field in the selected model. - New Value: The value to set. |
Output
The output is a JSON object representing the newly created record in the specified custom Odoo resource. The structure of the output depends on the fields defined in your custom model and the values you provided.
Example output:
{
"id": 123,
"field1": "value1",
"field2": "value2"
}
id: The unique identifier of the created record.- Other fields: Key-value pairs corresponding to the fields you set during creation, plus any default fields returned by Odoo.
Note: The exact output fields depend on your custom resource's schema.
Dependencies
- Odoo API: Requires access to your Odoo instance's API endpoint.
- Credentials: An n8n credential of type
odooApiwith the following:- Odoo URL
- Database name
- Username
- Password
No additional environment variables are required beyond the Odoo credentials.
Troubleshooting
Common issues:
- Invalid Credentials: If the Odoo credentials are incorrect, the node will return an authentication error. Double-check the URL, database, username, and password.
- Missing Required Fields: If you omit a required field for the custom resource, Odoo may return a validation error. Ensure all mandatory fields are included in the "Fields" property.
- Incorrect Model Name/ID: If the "Custom Resource Name or ID" does not match an existing Odoo model, the operation will fail.
- Field Name Mismatch: Using an incorrect field name or ID will result in an error from Odoo. Use the dropdown or verify the technical field names in your Odoo instance.
Error messages:
"Credentials are not valid": Check your Odoo API credentials."Settings are not valid: ...": There may be a configuration issue; review the full error message for details."error": "<message>"in output: Indicates a failure for that input item; check the message for specifics.
Links and References
- Odoo Official Documentation
- n8n Expressions Guide
- n8n Odoo Integration Docs (for general reference)