[ADD] tools: add escape_psql function

By default, Odoo support _ and % in domain to search like in pgsql.
But if you want to search something starting by _ or containing %
the developper need to escape these character.
This commit is contained in:
Jeremy Kersten
2016-01-08 19:14:31 +01:00
parent aabe0cb8fe
commit 774879a69c
+3
View File
@@ -4,3 +4,6 @@
def drop_view_if_exists(cr, viewname):
cr.execute("DROP view IF EXISTS %s CASCADE" % (viewname,))
cr.commit()
def escape_psql(to_escape):
return to_escape.replace('\\', r'\\').replace('%', '\%').replace('_', '\_')