Filtering contacts in n8n Odoo integration for SaaS deployment

I’m getting started with n8n automation and trying to set up a workflow with the Odoo connector. The basic connection works great and I can pull data without issues.

My goal is to create a daily automation that fetches customer records from Odoo and then syncs them with Revo. Both platforms are running as SaaS solutions.

The challenge I’m facing is that I need to apply some filtering logic to only import specific customer records rather than pulling everything. I’ve seen mentions of using “domain” parameters for filtering but haven’t found detailed documentation or examples showing how to implement this.

Is there anyone here who has successfully configured selective data import from Odoo through n8n? I’m looking for guidance on how to set up these filtering conditions properly.

Any help would be much appreciated!

Been there with n8n Odoo filtering - total headache. Domain syntax works but you’ll spend forever debugging those complex filter arrays.

I jumped to Latenode after hitting too many walls with n8n’s filtering limits. The visual interface beats wrestling with domain syntax every time.

Latenode uses drag-and-drop for filter conditions. No more guessing field names or debugging arrays. Error handling’s way better when filters go sideways too.

For your daily Odoo-Revo sync, Latenode handles scheduling and filtering in one workflow. Set up multiple filter conditions visually, test each one before running the full sync.

Conditional branching handles edge cases better than n8n. Like when certain customer records need different processing before hitting Revo.

Check it out: https://latenode.com

I hit the same filtering issues building Odoo-n8n workflows last year. The domain syntax above works, but test your filters in Odoo first before adding them to n8n. Go to your Odoo contacts, use advanced search to build the filter visually, then check the URL or dev tools for the exact domain structure. Saved me tons of trial and error. Quick heads up - API field names sometimes differ from what you see in the UI, so verify the technical names in Odoo’s developer mode. For daily syncs, filter by write_date instead of create_date to grab both new and updated records.

Domain filtering in Odoo through n8n is tricky at first, but the syntax gets straightforward once you nail it down. The domain parameter follows Odoo’s search conventions - structure it as an array of tuples with field name, operator, and value. Want to filter customers created after a certain date? Use [[‘create_date’, ‘>=’, ‘2024-01-01’]]. You can combine conditions with logical operators. In n8n’s Odoo node, find the additional fields section and add your domain parameter there. Field names must match your Odoo instance exactly - case sensitivity counts.

Navigating Odoo domains in n8n can be challenging, especially if you’re new to this setup. I’ve found it helpful to directly observe the network requests made by Odoo when applying filters. By inspecting the network tab in your browser’s developer tools, you can see the exact domain structure that Odoo uses. This insight allows you to reverse-engineer your desired conditions. I suggest starting with simpler conditions and gradually incorporating more complex logic, like combining AND/OR. For daily syncs, pay attention to error handling. Timeouts and API constraints can derail automation efforts, so test your domains with smaller datasets initially to ensure they work correctly.

This makes way more sense once you get how the structure works. I was stuck on this forever until I figured out that n8n just passes domains straight to Odoo’s search_read method. You need to build your filtering as nested arrays - each condition is [field_name, operator, value]. For daily customer syncs, I use [[‘write_date’, ‘>=’, yesterday_date], [‘active’, ‘=’, True]] to grab recent changes. Watch out for timezone issues though - your date filtering needs to handle UTC conversion or you’ll lose records. Build your domain step by step and test each condition before combining them. Also, calculated fields don’t work in domains, so stick with stored database fields for filtering.

Domain syntax is tricky, but here’s what works for me - start with limit and offset to test small chunks first. Once you’re comfortable with basic filters, you can stack conditions like [[‘is_company’, ‘=’, False], [‘customer_rank’, ‘>’, 0]] to grab only individual customers. Just make sure you handle empty results or your sync will crash.

The Problem:

You’re having trouble filtering customer records when importing data from Odoo to another platform using n8n. You understand the concept of using Odoo’s domain filtering, but you’re struggling with the correct syntax and implementation within the n8n workflow. The daily automation you’re building requires precise filtering to avoid importing unnecessary data.

:thinking: Understanding the “Why” (The Root Cause):

n8n passes the domain filter directly to Odoo’s search_read method. Understanding Odoo’s domain filter syntax is crucial for success. The syntax involves creating nested arrays where each array represents a single filtering condition. Each condition within the array consists of three elements: the field name, the operator, and the value. Incorrectly structured arrays will result in incorrect or no filtering. Additionally, using incorrect field names (case-sensitive), neglecting timezone considerations for date filters, or attempting to filter using calculated fields instead of stored database fields will cause failures.

:gear: Step-by-Step Guide:

  1. Start with Odoo’s Built-in Filters: The easiest way to determine the correct domain filter syntax is to use Odoo’s own search functionality. In your Odoo instance, navigate to the customer records and apply the filters you desire using the built-in search interface. Observe the resulting URL; it will contain the exact domain filter structure used in the request. This method prevents manual typing errors and ensures you’re using valid field names and operators. Copy this domain structure.

  2. Test with a Limited Dataset: Before implementing the full daily automation, test your filter with a smaller dataset. Use the limit and offset parameters in your Odoo node configuration to retrieve only a subset of records, greatly reducing the data processed for testing. This allows faster testing and avoids unnecessary API calls during development.

  3. Implement the Domain Filter in n8n: In the Odoo node within your n8n workflow, locate the field for additional fields (typically within the node’s settings). Paste the domain structure you copied from Odoo’s search URL into this field. Double-check that the field names precisely match your Odoo instance (case-sensitive).

  4. Handle Date and Timezone: If your filter involves date or time fields (create_date, write_date), pay close attention to timezone issues. Ensure that the date and time values in your domain filter are formatted correctly and use a consistent timezone throughout your workflow (preferably UTC). Incorrect timezones could cause you to miss or include records erroneously.

  5. Iterative Development: Build and test your domain filter conditions iteratively. Start with simple filters, test thoroughly, then add more conditions gradually. This makes debugging easier and allows you to pinpoint problems more readily.

  6. Verify API Rate Limits: Odoo’s API, especially in SaaS deployments, will likely have rate limits. Test your workflow over extended periods to ensure you haven’t exceeded these limits. Implement rate limiting mechanisms in your n8n workflow if necessary to prevent throttling.

:mag: Common Pitfalls & What to Check Next:

  • Field Name Mismatches: Double-check that the field names used in your domain filter exactly match the field names in your Odoo instance. Even a single space or capitalization difference will cause the filter to fail. Refer to Odoo’s developer documentation or use the developer mode to confirm the precise names of your fields.

  • Operator Usage: Ensure you’re using the correct Odoo operators for your filter conditions. Familiarize yourself with the available operators and choose the ones that best suit your filtering needs.

  • Empty Result Sets: Test your filter to ensure it does not unintentionally return an empty result set. Your workflow should account for the possibility that no records will match the defined criteria.

  • Data Type Compatibility: Verify that the data types of your filter values align with the corresponding Odoo fields.

:speech_balloon: Still running into issues? Share your (sanitized) config files, the exact command you ran, and any other relevant details. The community is here to help!

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.