Odoo
This component allows you to integrate your Nappai workflows with your Odoo ERP system. It acts as a central bridge to manage key business data, including Contacts, Notes, Opportunities, Sales Orders, Invoices, Picking Lists, Payments, and Products.
You can use this component to read, create, update, and synchronize data between Nappai and Odoo. It simplifies complex data transformations, ensuring your information flows smoothly between systems for tasks like automating billing, tracking sales leads, or managing customer records.
How it Works
The Odoo component connects directly to your Odoo instance via its API. When you configure this node, it authenticates your access and prepares to perform actions based on the settings you choose.
- Data Orchestration: The component can retrieve existing records from Odoo or send new data to create records in your ERP system.
- Smart Filtering: You can narrow down results using filters to find specific records quickly, such as locating an invoice by its reference or filtering customers by region.
- Data Transformation: Thanks to its advanced mapping capabilities, the component can automatically transform and structure your data to match Odoo’s requirements before sending it, and standardizes the data it returns for you to use in subsequent steps.
- Environment Control: You can specify whether the component interacts with a testing environment (sandbox) or your live production data, helping prevent accidental changes during development.
Connection & Credentials
To interact with your Odoo system, this component requires a secure API connection. Follow these steps to set up the connection:
- Go to the Credentials section in your Nappai panel.
- Create a new credential of the type Odoo API.
- Fill in the required details:
- Odoo Server URL: Your Odoo instance address.
- Database Name: The name of your Odoo database.
- Username: Your login email or user name.
- API Key: Your secure API password.
- Once saved, return to your workflow and select this credential in the Connection input field of the Odoo component.
Note: Ensure your API credentials have the necessary permissions in Odoo to perform the actions you intend (e.g., read/write access to contacts and invoices).
Inputs
This component offers a wide range of inputs depending on the resource type and operation you select. Below is a list of available fields:
Mapping Mode
This component supports a special Mapping Mode. When enabled, each input field offers you three ways to provide data, giving you maximum flexibility:
- Fixed: Type a static value directly into the field.
- Mapped: Connect the output of another component to use dynamic data from your workflow.
- Javascript: Write custom code to calculate or transform the value on the fly.
Input Fields
- Operation: Select the specific action you want to perform. Use the dropdown to choose from available operations supported by the component.
- Connection: Select the Odoo API credential configured in your Nappai credentials.
- Environment: Choose between
productionfor live data orsandboxfor testing. - Operation Scope: Define which modules or entities (e.g., Sales, Invoices, Contacts) the component should affect.
- Resource Type: Choose the type of Odoo resource you want to work with, such as Contact, Note, Opportunity, Invoice, Payment, or Product. Select “Custom Resource” if your resource type is not listed.
- Resource Name: If using a Custom Resource, provide the name of the resource here.
- Resource Data: Provide custom data structure for Custom Resources. You can map fields like
name,email, ormemodepending on the resource. - Name: The name of the record (e.g., contact name, opportunity name, product name). Required for creating records.
- Email: The email address for a Contact resource.
- Phone: The phone number for a Contact resource.
- Memo: The text content for a Note resource.
- Open: A boolean option to specify if a Note should be open or closed.
- Color: An integer value representing the color of a Note.
- Partner ID: The unique ID of an existing contact to associate with an opportunity or other record.
- Probability: A percentage value (0-100) indicating the likelihood of a sales opportunity closing.
- Expected Revenue: The estimated revenue amount for an opportunity.
- Lead: A boolean flag indicating the type of opportunity (e.g., lead vs. opportunity).
- Customer (Partner ID): The ID of the customer associated with a Sales Order, Invoice, or Payment.
- Order Lines: Data input for list items in a Sales Order, including product details and quantities.
- Invoice Type: Select the type of accounting entry for an Invoice.
- Invoice Lines: Data input for list items in an Invoice.
- Invoice Date: The date of the invoice in
YYYY-MM-DDformat. Leave empty for today. - Source Document: Reference to the source document, such as a Sale Order name.
- Amount: The payment amount for a Payment record.
- Journal ID: The ID of the payment journal (e.g., bank journal).
- Payment Type: Select the type of payment action.
- Sale Price: The price of the product.
- Product Type: Select the type of product.
- Internal Reference: The SKU or internal reference code for a product.
- Resource ID: The unique ID of a resource you want to modify or update.
- Fields: Specify which fields to retrieve or show for a resource.
- Top: The maximum number of resources to retrieve.
- Filters: Define criteria to narrow down returned records. Use JSON format to filter by field name, operator, and value.
- Example: Filter invoices by status or amount.
Outputs
- Data: Returns the processed result from Odoo. This output contains the records created, updated, or retrieved, structured in a format ready to be used by downstream components. You can map this output to other nodes to continue automating your workflow.
Output Data Example (JSON)
json { “status”: “success”, “data”: [ { “id”: 1042, “name”: “Acme Corp”, “email”: “contact@acme.com”, “type”: “contact”, “created_at”: “2023-10-27T10:00:00Z” } ], “diagnostics”: { “execution_time_ms”: 120, “records_processed”: 1, “api_warnings”: [] } }
Connectivity
This component is versatile and can connect to various parts of your workflow:
- Upstream: Connect to data sources, triggers, or other automation nodes that provide the information needed for Odoo (e.g., customer details from a form or product data from an e-commerce node).
- Downstream: Connect the Data output to nodes that require processing the results, such as:
- Email or Notification nodes to confirm actions.
- Data transformation nodes to format the returned records.
- Conditional branches to handle success or error states based on the status.
Usage Example
Scenario: Automating Customer Onboarding
- Trigger: Your workflow starts when a new lead is captured.
- Odoo Component:
- Select the Operation for creating a Contact.
- Map the Name and Email from your lead source.
- The component sends this data to Odoo and creates the contact.
- Next Step: Use the Data output from the Odoo node to create a corresponding Opportunity in Odoo, linking it to the newly created Contact ID.
- Result: Your Odoo database is automatically updated with the customer’s information and a linked opportunity, ready for your sales team.
Tips and Best Practices
- Use Filters Wisely: When retrieving data, use the Filters input to narrow down results. This improves performance and ensures you work with the exact records you need.
- Map Dynamic Data: Use the Mapping Mode to connect inputs to dynamic values from previous nodes rather than typing static data. This makes your workflows adaptable.
- Check Permissions: Ensure your Odoo API user has the correct access rights for the resources you are managing. Lack of permissions may cause errors.
- Test with Sandbox: Use the Environment setting to point to a sandbox instance while testing new workflows. Switch to production only when you are confident in the configuration.
- Validate IDs: When updating records, always ensure you have the correct Resource ID or Partner ID. Using incorrect IDs can lead to errors or data mismatches.
- Handle Errors: Check the Status output of the component. If an operation fails, the output will indicate the error, allowing you to add retry logic or notifications in your workflow.
Security Considerations
- Credential Safety: Never share or hardcode your API credentials. Always use the Credentials section in Nappai to store them securely.
- Least Privilege: Configure your Odoo API key with only the permissions necessary for your automation tasks. Avoid using admin credentials for routine operations.
- Data Privacy: Be mindful of the data you sync. Ensure you comply with data protection regulations when transferring sensitive information like customer emails or financial records.
- Secure Connections: Ensure your Odoo Server URL uses HTTPS to encrypt data in transit.