Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
391 Zobrazení

How can I create a custom filter where the selection criteria are expressed across company contacts and person contacts? For example, I'd like to search for all person contacts who have a specific tag who are associated with company contacts that have a different specific tag. The result would be a list that contains only contacts that meet the individual and company search criteria.

Avatar
Zrušit
Nejlepší odpověď

To verify the filter that is created (or to even manually create the expression) I'd suggest you to first enable the Developer mode (https://www.odoo.com/documentation/18.0/applications/general/developer_mode.html). Doing so you will see additional information when creating a filter.

Furthermore, I'd like to suggest you to save the created search (even if it's just partial one at that point) as a favorite. This way you can establish a base line filtering and work from there without constantly needing to rebuild the filter from scratch all the time.

That being said, a filter meeting your criteria could look like this:

["&", ("parent_id.category_id", "in", [10, 11]), ("category_id", "in", [8, 9])]

Note: 
category_id 8 = 'abc'
category_id 9 = 'xyz'
category_id 10 = '123'
category_id 11 = '456'

The sample set of data looks like this:


With above filter, you're result will be:


Whether or not you want '=' (is equal) or 'has' (in) filters, depends on your exact requirement. But, given above Search Domain snippet (a Search Domain is a filter expression) you should be able to easily tweak it. You can also copy and paste it into the 'Code editor' field in the Custom Filter (when Developer Mode is active.

The UI version of this filter looks like this:

Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
3
zář 25
549
1
zář 25
1955
0
čvc 25
1189
1
kvě 25
1908
ADD PROPERTIES Vyřešeno
1
kvě 25
6471