diff --git a/trytond/trytond/model/fields/char.py b/trytond/trytond/model/fields/char.py index 1d113d9fcf0..7b0805c2f83 100644 --- a/trytond/trytond/model/fields/char.py +++ b/trytond/trytond/model/fields/char.py @@ -149,7 +149,7 @@ def convert_domain(self, domain, tables, Model): threshold = context.get( '%s.%s.search_similarity' % (Model.__name__, name), context.get('search_similarity')) - if database.has_similarity() and is_full_text(value) and threshold: + if threshold and database.has_similarity() and is_full_text(value): sim_value = unescape_wildcard(value) sim_value = self._domain_value(operator, sim_value) expression = ( diff --git a/trytond/trytond/tools/misc.py b/trytond/trytond/tools/misc.py index 79900f058af..26fdc32ca32 100644 --- a/trytond/trytond/tools/misc.py +++ b/trytond/trytond/tools/misc.py @@ -245,6 +245,8 @@ def unescape_wildcard(string, wildcards='%_', escape='\\'): def is_full_text(value, escape='\\'): + if not value: + return False escaped = strip_wildcard(value, escape=escape) escaped = escaped.replace(escape + '%', '').replace(escape + '_', '') if '%' in escaped or '_' in escaped: