From 021438b07eb52d1e3e3e11aa583f827d78886536 Mon Sep 17 00:00:00 2001 From: mreficent Date: Mon, 25 Jun 2018 16:14:50 +0200 Subject: [PATCH] [FIX] mogrify doesn't allow dicts --- sql_request_abstract/__openerp__.py | 2 +- sql_request_abstract/models/sql_request_mixin.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/sql_request_abstract/__openerp__.py b/sql_request_abstract/__openerp__.py index f909dcc3c..7cdcb8d42 100644 --- a/sql_request_abstract/__openerp__.py +++ b/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', diff --git a/sql_request_abstract/models/sql_request_mixin.py b/sql_request_abstract/models/sql_request_mixin.py index d7df1f85c..665daed89 100644 --- a/sql_request_abstract/models/sql_request_mixin.py +++ b/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