diff options
| author | Xavier Morel <xmo@odoo.com> | 2017-05-15 16:13:28 +0200 |
|---|---|---|
| committer | Olivier Dony <odo@openerp.com> | 2017-08-20 23:25:54 +0200 |
| commit | 9d83784f1df18306b6166fd92a0573f39bf6262d (patch) | |
| tree | ad92db574434ca44916fdb4384d96e55f3b2324c | |
| parent | 91fe7709455d3f90b9aa5784e8cc05a410d03130 (diff) | |
[FIX] P3: "mogrify" returns bytes, decode it
Otherwise when the subquery is somehow injected in the parent
query (didn't find where but...) it's b-prefixed and treated as a
binary rather than a sub-query somehow, which fails.
| -rw-r--r-- | odoo/osv/expression.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/odoo/osv/expression.py b/odoo/osv/expression.py index c1363c4f06d..761b9bef4fe 100644 --- a/odoo/osv/expression.py +++ b/odoo/osv/expression.py @@ -988,7 +988,7 @@ class expression(object): else: subquery = 'SELECT "%s" FROM "%s" WHERE "%s" IN %%s' % (rel_id1, rel_table, rel_id2) # avoid flattening of argument in to_sql() - subquery = cr.mogrify(subquery, [tuple(ids2)]) + subquery = cr.mogrify(subquery, [tuple(ids2)]).decode('utf-8') push(create_substitution_leaf(leaf, ('id', 'inselect', (subquery, [])), internal=True)) else: call_null_m2m = True @@ -1018,7 +1018,7 @@ class expression(object): subop = 'not inselect' if operator in NEGATIVE_TERM_OPERATORS else 'inselect' subquery = 'SELECT "%s" FROM "%s" WHERE "%s" IN %%s' % (rel_id1, rel_table, rel_id2) # avoid flattening of argument in to_sql() - subquery = cr.mogrify(subquery, [tuple(it for it in res_ids if it)]) + subquery = cr.mogrify(subquery, [tuple(it for it in res_ids if it)]).decode('utf-8') push(create_substitution_leaf(leaf, ('id', subop, (subquery, [])), internal=True)) if call_null_m2m: |
