Search code examples
pythonodoo

Where to use =like operator? Difference between like and =like?


Where to use like and =like operators in openerp. What is the difference between these two?

I want use =like in an openerp method for string matching. Can I do this?


Solution

  • If you don't use the = operator, the result will be the given string with [prefixes] and/or [suffixes]. For example:

    Domain with like:

    [('name', 'like', 'tangaraj')]
    

    This domain will give you records whose name is tangaraj, tangaraja, anyprefixtangarajanysuffix, etc... but it will not give you Tangaraj, because it distinguishes between uppercase and lowercase.

    Domain with =like:

    [('name', '=like', 'tangaraj')]
    

    This one will give you only records whose name is tangaraj, as the = operator will do.