Browse Source

Merge pull request #1302 from Eficent/8.0-fix-sql_request_abstract-mogrify

[8.0][FIX] sql_request_abstract: mogrify doesn't allow dicts
pull/1326/head
Jordi Ballester Alomar 7 years ago
committed by GitHub
parent
commit
cb1bb2dd7c
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',
'version': '8.0.1.0.0',
'version': '8.0.1.0.1',
'author': 'GRAP,Akretion,Odoo Community Association (OCA)',
'website': 'https://www.odoo-community.org',
'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'):
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'):
pass

Loading…
Cancel
Save