summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorJay (Open ERP) <jvo@tinyerp.com>2009-07-06 16:16:15 +0530
committerJay (Open ERP) <jvo@tinyerp.com>2009-07-06 16:16:15 +0530
commit0fa5ef8c76e6156f80bb32e8b89bd2c34c072fbf (patch)
treec10a974bbb9627521ec8538d62442ec055712753 /bin
parent5669861059844144724878235a465e847bd450f2 (diff)
[FIX] Expression calculation(Query making) corrected for Translateable field
bzr revid: jvo@tinyerp.com-20090706104615-dj50oi5ni1fhez48
Diffstat (limited to 'bin')
-rw-r--r--bin/osv/expression.py20
1 files changed, 16 insertions, 4 deletions
diff --git a/bin/osv/expression.py b/bin/osv/expression.py
index 52abe2eaf2c..b849e77bd08 100644
--- a/bin/osv/expression.py
+++ b/bin/osv/expression.py
@@ -201,18 +201,30 @@ class expression(object):
if field.translate:
if operator in ('like', 'ilike', 'not like', 'not ilike'):
right = '%%%s%%' % right
+
+ operator = operator == '=like' and 'like' or operator
query1 = '( SELECT res_id' \
' FROM ir_translation' \
' WHERE name = %s' \
' AND lang = %s' \
- ' AND type = %s' \
- ' AND value ' + operator + ' %s' \
+ ' AND type = %s'
+ instr = ' %s'
+ #Covering in,not in operators with operands (%s,%s) ,etc.
+ if operator in ['in','not in']:
+ instr = ','.join(['%s'] * len(right))
+ query1 += ' AND value ' + operator + ' ' +" (" + instr + ")" \
') UNION (' \
' SELECT id' \
' FROM "' + working_table._table + '"' \
- ' WHERE "' + left + '" ' + operator + ' %s' \
- ')'
+ ' WHERE "' + left + '" ' + operator + ' ' +" (" + instr + "))"
+ else:
+ query1 += ' AND value ' + operator + instr + \
+ ') UNION (' \
+ ' SELECT id' \
+ ' FROM "' + working_table._table + '"' \
+ ' WHERE "' + left + '" ' + operator + instr + ")"
+
query2 = [working_table._name + ',' + left,
context.get('lang', False) or 'en_US',
'model',