filterodooodoo-15startswithmailing-list

How to set "not Starts with" in Odoo Mailing List filter?


I have a dynamic Mailing List in Odoo version 15.0+e
and I want to exclude all the contacts where Zip code starts with K.

Using debug mode, I set the code in Editor according to this as the following:

["&",["is_blacklisted","!=",True],["zip","not ilike","K%"]]

The Synchronization criteria then looks like
enter image description here

It says does not contain which looks strange to me. And it actually works as does not contain. But I need does not starts with, not does not contain. It excludes all the records where K is present in Zip code. But again, I need to exclude only the records where Zip code starts with K.

I experimented and found that in my case:
['zip', '=ilike', 'K%'] gives 256 Recipients where Zip starts with K and is shown as enter image description here

['zip', 'ilike', 'K%'] gives 697 Recipients where Zip contains K and is shown as Zip contains "K%": enter image description here

As we can see, = mark determines the difference between Starts with and Contains !
If I have to use =ilike for Starts with, I don't understand how I can connect not with =ilike to get Not Starts with:

not =ilike doesn't work, and =not ilike, and = not ilike don't work.

enter image description here

How can I implement Not Starts with logic in Odoo Mailing List filter?


Solution

  • You already found out a lot. You just need to logically invert your domain part with the NOT-operator "!":

    ["&", ["is_blacklisted", "!=", True], "!", ["zip", "=ilike", "K%"]]

    The domain widget has no functionality to show this domain as correct text output, atleast not in Odoo 15.