[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:
@@ -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('_', '\_')
|
||||
|
||||
Reference in New Issue
Block a user