Browse Source

Merge pull request #1301 from Eficent/9.0-fix-sql_request_abstract-mogrify

[9.0][FIX] sql_request_abstract: mogrify doesn't allow dicts
pull/1327/head
Jordi Ballester Alomar 7 years ago
committed by GitHub
parent
commit
b46e4f37c4
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  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