Odoo icon

Odoo

Tương tác với Odoo ERP

Actions2

Overview

This node interacts with Odoo ERP to find records in a specified custom resource (model) by searching for field values that match given criteria. It is useful when you want to query Odoo data dynamically based on one or more fields and retrieve matching records.

Common scenarios include:

  • Searching for customers, products, or any custom model records in Odoo by specific attributes.
  • Filtering records using various comparison operators like equals, not equals, greater than, etc.
  • Retrieving either all matching records or limiting the number of results.
  • Selecting specific fields to return and sorting the results.

For example, you could use this node to find all partners whose email contains "example.com" or all products with a price greater than 100.

Properties

Name Meaning
Custom Resource Name The Odoo model name for the custom resource to query (e.g., res.partner, product.product).
Search Fields A collection of search conditions where each condition includes:
- Field Name: The field to filter by.
- Field Value: The value to compare.
- Operator: Comparison operator (=, !=, like, >, <, >=, <=).
Return All Boolean flag indicating whether to return all matching records or limit the result set.
Limit Maximum number of records to return if Return All is false. Minimum is 1.
Options Additional options:
- Return Fields: Comma-separated list of fields to include in the output (empty means all fields).
- Sort: Comma-separated sort order, e.g., name asc, id desc.

Output

The node outputs an array of JSON objects representing the records found in the specified custom resource that match the search criteria.

  • Each object corresponds to one record.
  • The fields included depend on the "Return Fields" option; if empty, all fields are returned.
  • Sorting and limiting are applied as per input parameters.
  • No binary data output is produced by this node.

Example output JSON snippet:

[
  {
    "id": 123,
    "name": "John Doe",
    "email": "[email protected]"
  },
  {
    "id": 456,
    "name": "Jane Smith",
    "email": "[email protected]"
  }
]

Dependencies

  • Requires connection credentials to an Odoo ERP instance, including URL, database name, username, and authentication method (user/password or API key).
  • The node depends on the Odoo API being accessible and properly configured.
  • No additional external libraries beyond those bundled with the node are required.

Troubleshooting

  • No records found: Check that the field names and values are correct and exist in the Odoo model. Also verify the operator used matches your intended logic.
  • Authentication errors: Ensure the provided credentials (URL, database, username, password/API key) are valid and have sufficient permissions.
  • Invalid field names: Using a field name that does not exist in the model will cause errors. Confirm field names via Odoo's model schema.
  • Limit ignored: If Return All is true, the Limit parameter is ignored.
  • Sorting issues: Incorrect syntax in the "Sort" option may lead to unexpected ordering or errors. Use the format fieldName asc or fieldName desc.

Links and References

Discussion