Browse Source

[MIG] sql_request_abstract: Migration to 11.0

pull/1459/head
hveficent 6 years ago
committed by Adrià Gil Sorribes
parent
commit
3ff77b5d6c
  1. 6
      sql_request_abstract/README.rst
  2. 1
      sql_request_abstract/__init__.py
  3. 3
      sql_request_abstract/__manifest__.py
  4. 1
      sql_request_abstract/models/__init__.py
  5. 13
      sql_request_abstract/models/sql_request_mixin.py

6
sql_request_abstract/README.rst

@ -1,4 +1,4 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
@ -6,7 +6,7 @@
Abstract Model to manage SQL Requests
=====================================
This module provide an abstract model to manage SQL Select request on database.
This module provides an abstract model to manage SQL Select requests on database.
It is not usefull for itself. You can see an exemple of implementation in the
'sql_export' module. (same repository).
@ -45,7 +45,7 @@ Inherit the model:
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/149/10.0
:target: https://runbot.odoo-community.org/runbot/149/11.0
Bug Tracker
===========

1
sql_request_abstract/__init__.py

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import models

3
sql_request_abstract/__manifest__.py

@ -1,11 +1,10 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2017 - Today: GRAP (http://www.grap.coop)
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
'name': 'SQL Request Abstract',
'version': '10.0.1.0.1',
'version': '11.0.1.0.1',
'author': 'GRAP,Akretion,Odoo Community Association (OCA)',
'website': 'https://www.odoo-community.org',
'license': 'AGPL-3',

1
sql_request_abstract/models/__init__.py

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import sql_request_mixin

13
sql_request_abstract/models/sql_request_mixin.py

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2015 Akretion (<http://www.akretion.com>)
# Copyright (C) 2017 - Today: GRAP (http://www.grap.coop)
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
@ -6,7 +5,7 @@
import re
import uuid
import StringIO
from io import StringIO
import base64
from psycopg2 import ProgrammingError
@ -144,10 +143,12 @@ class SQLRequestMixin(models.AbstractModel):
if mode in ('view', 'materialized_view'):
rollback = False
params = params or {}
# pylint: disable=sql-injection
query = self.query % params
query = query.decode('utf-8')
if params:
query = self.query % params
else:
query = self.query
query = query
if mode in ('fetchone', 'fetchall'):
pass
@ -242,7 +243,7 @@ class SQLRequestMixin(models.AbstractModel):
res = self._hook_executed_request()
except ProgrammingError as e:
raise UserError(
_("The SQL query is not valid:\n\n %s") % e.message)
_("The SQL query is not valid:\n\n %s") % e)
finally:
self._rollback_savepoint(rollback_name)
return res

Loading…
Cancel
Save