Browse Source

[FIX] mogrify doesn't allow dicts

pull/1301/head
mreficent 7 years ago
parent
commit
bcc690fa84
  1. 2
      sql_request_abstract/__openerp__.py
  2. 6
      sql_request_abstract/models/sql_request_mixin.py

2
sql_request_abstract/__openerp__.py

@ -5,7 +5,7 @@
{ {
'name': 'SQL Request Abstract', 'name': 'SQL Request Abstract',
'version': '9.0.1.0.0',
'version': '9.0.1.0.1',
'author': 'GRAP,Akretion,Odoo Community Association (OCA)', 'author': 'GRAP,Akretion,Odoo Community Association (OCA)',
'website': 'https://www.odoo-community.org', 'website': 'https://www.odoo-community.org',
'license': 'AGPL-3', 'license': 'AGPL-3',

6
sql_request_abstract/models/sql_request_mixin.py

@ -144,8 +144,10 @@ class SQLRequestMixin(models.AbstractModel):
if mode in ('view', 'materialized_view'): if mode in ('view', 'materialized_view'):
rollback = False rollback = False
params = params and params or {}
query = self.env.cr.mogrify(self.query, params).decode('utf-8')
params = params or {}
# pylint: disable=sql-injection
query = self.query % params
query = query.decode('utf-8')
if mode in ('fetchone', 'fetchall'): if mode in ('fetchone', 'fetchall'):
pass pass

Loading…
Cancel
Save