Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit e92f994

Browse files
authoredMar 17, 2025··
Add Odoo domain filter documentation
1 parent 74e345a commit e92f994

File tree

1 file changed

+38
-6
lines changed

1 file changed

+38
-6
lines changed
 

Diff for: ‎docs/integrations/builtin/app-nodes/n8n-nodes-base.odoo.md

+38-6
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,6 @@ Refer to [Odoo credentials](/integrations/builtin/credentials/odoo.md) for guida
2626
* Get a contact
2727
* Get all contacts
2828
* Update a contact
29-
* Custom Resource
30-
* Create a new item
31-
* Delete an item
32-
* Get an item
33-
* Get all items
34-
* Update an item
3529
* Note
3630
* Create a new note
3731
* Delete a note
@@ -44,6 +38,44 @@ Refer to [Odoo credentials](/integrations/builtin/credentials/odoo.md) for guida
4438
* Get an opportunity
4539
* Get all opportunities
4640
* Update an opportunity
41+
* Custom Resource
42+
* Create a new item
43+
* Delete an item
44+
* Get an item
45+
* Get all items
46+
* Update an item
47+
48+
## Custom Resources
49+
50+
When calling a custom resource you are able to call any model in Odoo. The call is transformed into a JSON RPC call on the Odoo side of things. This is helpful to keep in mind when building the filters.
51+
52+
53+
### Adding a filter
54+
55+
Click **Add condition** after selecting **Custom Resource** from the **Resource** dropdown. These filters work well for discrete values. If there are values in your Odoo instance that are falsey or truthy then it might be better
56+
to use a **Domain filter**.
57+
58+
### Using domain filters
59+
60+
The **Domain Filter** field is only available for **Custom Resource**. It takes a JSON object and passes it to Odoo's JSON RPC. Odoo converts this into a Python Tuple to filter the model on upon execution. Below is a table for some Odoo domains and how they would be entered in the string field of **Domain Filter** in the Odoo node on n8n.
61+
62+
63+
| Odoo Domain Filter | n8n Odoo Domain Filter String |
64+
| -------------------- | ------------------------------------------------ |
65+
| `[("intended_use", "=", False)]` | `[["intended_use", "=", false]]` |
66+
| `["&", ("detailed_type", "=", "product"), "&", ("type", "=", "product"), ("reduced_template_price", "!=", False)]` | `["&", ["detailed_type", "=", "product"], "&", ["type", "=", "product"], ["reduced_template_price", "!=", false]]` |
67+
68+
You can "convert" a tuple to a JSON object by copying the Python Tuple and running it with a simple Python script:
69+
70+
```python
71+
import json
72+
73+
tuple = [("intended_use", "=", False)]
74+
json.dumps(tuple)
75+
76+
# outputs: [["intended_use", "=", false]]
77+
```
78+
4779

4880
## Templates and examples
4981

0 commit comments

Comments
 (0)
Please sign in to comment.