openerp-community-reviewer team mailing list archive
-
openerp-community-reviewer team
-
Mailing list archive
-
Message #03347
[Merge] lp:~yann-papouin/ocb-server/6.1-bug-1049653-translatable-unaccent into lp:ocb-server/6.1
Yann Papouin has proposed merging lp:~yann-papouin/ocb-server/6.1-bug-1049653-translatable-unaccent into lp:ocb-server/6.1.
Requested reviews:
OpenERP Community Backports Team (ocb)
Related bugs:
Bug #1049653 in OpenERP Server: "--unaccent option does not work"
https://bugs.launchpad.net/openobject-server/+bug/1049653
For more details, see:
https://code.launchpad.net/~yann-papouin/ocb-server/6.1-bug-1049653-translatable-unaccent/+merge/204252
--
https://code.launchpad.net/~yann-papouin/ocb-server/6.1-bug-1049653-translatable-unaccent/+merge/204252
Your team OpenERP Community Backports Team is requested to review the proposed merge of lp:~yann-papouin/ocb-server/6.1-bug-1049653-translatable-unaccent into lp:ocb-server/6.1.
=== modified file 'openerp/osv/expression.py'
--- openerp/osv/expression.py 2012-01-24 12:42:52 +0000
+++ openerp/osv/expression.py 2014-01-31 14:58:05 +0000
@@ -637,11 +637,18 @@
' FROM "' + working_table._table + '"' \
' WHERE "' + left + '" ' + sql_operator + ' ' +" (" + instr + "))"
else:
- subselect += ' AND value ' + sql_operator + instr + \
- ') UNION (' \
- ' SELECT id' \
- ' FROM "' + working_table._table + '"' \
- ' WHERE "' + left + '" ' + sql_operator + instr + ")"
+ if self.has_unaccent and sql_operator in ('ilike', 'not ilike'):
+ subselect += ' AND unaccent(value) ' + sql_operator + ' unaccent(' + instr + \
+ ')) UNION (' \
+ ' SELECT id' \
+ ' FROM "' + working_table._table + '"' \
+ ' WHERE unaccent("' + left + '") ' + sql_operator + ' unaccent(' + instr + '))'
+ else:
+ subselect += ' AND value ' + sql_operator + instr + \
+ ') UNION (' \
+ ' SELECT id' \
+ ' FROM "' + working_table._table + '"' \
+ ' WHERE "' + left + '" ' + sql_operator + instr + ")"
params = [working_table._name + ',' + left,
context.get('lang', False) or 'en_US',
Follow ups