From 90b71def037a4af3bbee4ddc2129e5cd1aa45aab Mon Sep 17 00:00:00 2001 From: Sergio Teruel Date: Wed, 8 Jan 2020 10:40:38 +0100 Subject: [PATCH] [MIG] base_external_dbsource_mssql: Migration to v12.0 [UPD] Update base_external_dbsource_mssql.pot --- base_external_dbsource_mssql/README.rst | 12 +++---- base_external_dbsource_mssql/__manifest__.py | 31 ++++++------------- .../i18n/base_external_dbsource_mssql.pot | 2 +- .../models/base_external_dbsource.py | 17 +++++----- .../readme/CONTRIBUTORS.rst | 2 +- .../readme/ROADMAP.rst | 2 +- .../static/description/index.html | 16 +++++++--- .../tests/test_base_external_dbsource.py | 19 +++++------- 8 files changed, 46 insertions(+), 55 deletions(-) diff --git a/base_external_dbsource_mssql/README.rst b/base_external_dbsource_mssql/README.rst index b2cda6d5..c4586fa0 100644 --- a/base_external_dbsource_mssql/README.rst +++ b/base_external_dbsource_mssql/README.rst @@ -14,13 +14,13 @@ External Database Source - MSSQL :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html :alt: License: LGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--backend-lightgray.png?logo=github - :target: https://github.com/OCA/server-backend/tree/11.0/base_external_dbsource_mssql + :target: https://github.com/OCA/server-backend/tree/12.0/base_external_dbsource_mssql :alt: OCA/server-backend .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/server-backend-11-0/server-backend-11-0-base_external_dbsource_mssql + :target: https://translation.odoo-community.org/projects/server-backend-12-0/server-backend-12-0-base_external_dbsource_mssql :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/253/11.0 + :target: https://runbot.odoo-community.org/runbot/253/12.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -74,7 +74,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -95,7 +95,7 @@ Contributors * Gervais Naoussi * Dave Lasley * `Tecnativa `_: - * Sergio Teruel + * Sergio Teruel Maintainers ~~~~~~~~~~~ @@ -110,6 +110,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use. -This module is part of the `OCA/server-backend `_ project on GitHub. +This module is part of the `OCA/server-backend `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/base_external_dbsource_mssql/__manifest__.py b/base_external_dbsource_mssql/__manifest__.py index 4c6ae726..1104d060 100644 --- a/base_external_dbsource_mssql/__manifest__.py +++ b/base_external_dbsource_mssql/__manifest__.py @@ -2,25 +2,14 @@ # Copyright 2016 LasLabs Inc. # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). { - 'name': 'External Database Source - MSSQL', - 'version': '11.0.1.0.0', - 'category': 'Tools', - 'author': "Daniel Reis, " - "LasLabs, " - "Odoo Community Association (OCA)", - 'website': 'https://github.com/OCA/server-backend', - 'license': 'LGPL-3', - 'depends': [ - 'base_external_dbsource_sqlite', - ], - 'external_dependencies': { - 'python': [ - 'sqlalchemy', - 'pymssql', - ], - }, - 'demo': [ - 'demo/base_external_dbsource.xml', - ], - 'installable': True, + "name": "External Database Source - MSSQL", + "version": "12.0.1.0.0", + "category": "Tools", + "author": "Daniel Reis, " "LasLabs, " "Odoo Community Association (OCA)", + "website": "https://github.com/OCA/server-backend", + "license": "LGPL-3", + "depends": ["base_external_dbsource_sqlite"], + "external_dependencies": {"python": ["sqlalchemy", "pymssql"]}, + "demo": ["demo/base_external_dbsource.xml"], + "installable": True, } diff --git a/base_external_dbsource_mssql/i18n/base_external_dbsource_mssql.pot b/base_external_dbsource_mssql/i18n/base_external_dbsource_mssql.pot index e37bb794..9e07f689 100644 --- a/base_external_dbsource_mssql/i18n/base_external_dbsource_mssql.pot +++ b/base_external_dbsource_mssql/i18n/base_external_dbsource_mssql.pot @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 11.0\n" +"Project-Id-Version: Odoo Server 12.0\n" "Report-Msgid-Bugs-To: \n" "Last-Translator: <>\n" "Language-Team: \n" diff --git a/base_external_dbsource_mssql/models/base_external_dbsource.py b/base_external_dbsource_mssql/models/base_external_dbsource.py index bb1b671a..180097f5 100644 --- a/base_external_dbsource_mssql/models/base_external_dbsource.py +++ b/base_external_dbsource_mssql/models/base_external_dbsource.py @@ -9,19 +9,20 @@ from odoo import api, models _logger = logging.getLogger(__name__) try: - from odoo.addons.base_external_dbsource.models import ( - base_external_dbsource, - ) + from odoo.addons.base_external_dbsource.models import base_external_dbsource + CONNECTORS = base_external_dbsource.BaseExternalDbsource.CONNECTORS try: import pymssql - CONNECTORS.append(('mssql', 'Microsoft SQL Server')) + + CONNECTORS.append(("mssql", "Microsoft SQL Server")) assert pymssql except (ImportError, AssertionError): - _logger.info('MS SQL Server not available. Please install "pymssql" ' - 'python package.') + _logger.info( + 'MS SQL Server not available. Please install "pymssql" ' "python package." + ) except ImportError: - _logger.info('base_external_dbsource Odoo module not found.') + _logger.info("base_external_dbsource Odoo module not found.") class BaseExternalDbsource(models.Model): @@ -29,7 +30,7 @@ class BaseExternalDbsource(models.Model): _inherit = "base.external.dbsource" - PWD_STRING_MSSQL = 'Password=%s;' + PWD_STRING_MSSQL = "Password=%s;" @api.multi def connection_close_mssql(self, connection): diff --git a/base_external_dbsource_mssql/readme/CONTRIBUTORS.rst b/base_external_dbsource_mssql/readme/CONTRIBUTORS.rst index d00499db..0d2405cf 100644 --- a/base_external_dbsource_mssql/readme/CONTRIBUTORS.rst +++ b/base_external_dbsource_mssql/readme/CONTRIBUTORS.rst @@ -3,4 +3,4 @@ * Gervais Naoussi * Dave Lasley * `Tecnativa `_: - * Sergio Teruel + * Sergio Teruel diff --git a/base_external_dbsource_mssql/readme/ROADMAP.rst b/base_external_dbsource_mssql/readme/ROADMAP.rst index fdddc735..8b025883 100644 --- a/base_external_dbsource_mssql/readme/ROADMAP.rst +++ b/base_external_dbsource_mssql/readme/ROADMAP.rst @@ -1 +1 @@ -* Add X.509 authentication \ No newline at end of file +* Add X.509 authentication diff --git a/base_external_dbsource_mssql/static/description/index.html b/base_external_dbsource_mssql/static/description/index.html index 0ef2f37a..f44dae37 100644 --- a/base_external_dbsource_mssql/static/description/index.html +++ b/base_external_dbsource_mssql/static/description/index.html @@ -367,7 +367,7 @@ ul.auto-toc { !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Beta License: LGPL-3 OCA/server-backend Translate me on Weblate Try me on Runbot

+

Beta License: LGPL-3 OCA/server-backend Translate me on Weblate Try me on Runbot

This module extends base_external_dbsource, allowing you to connect to foreign MSSQL databases using SQLAlchemy.

Table of contents

@@ -426,7 +426,7 @@ Database Structure > Database sources.

Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed -feedback.

+feedback.

Do not contact contributors directly about support or help with technical issues.

@@ -445,8 +445,14 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
  • Maxime Chambreuil <maxime.chambreuil@savoirfairelinux.com>
  • Gervais Naoussi <gervaisnaoussi@gmail.com>
  • Dave Lasley <dave@laslabs.com>
  • -
  • Tecnativa: -* Sergio Teruel
  • +
  • +
    Tecnativa:
    +
      +
    • Sergio Teruel
    • +
    +
    +
    +
  • @@ -456,7 +462,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome

    OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.

    -

    This module is part of the OCA/server-backend project on GitHub.

    +

    This module is part of the OCA/server-backend project on GitHub.

    You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

    diff --git a/base_external_dbsource_mssql/tests/test_base_external_dbsource.py b/base_external_dbsource_mssql/tests/test_base_external_dbsource.py index fcb6a3c6..240396d6 100644 --- a/base_external_dbsource_mssql/tests/test_base_external_dbsource.py +++ b/base_external_dbsource_mssql/tests/test_base_external_dbsource.py @@ -4,18 +4,15 @@ import mock from odoo.tests import common - -ADAPTER = ('odoo.addons.base_external_dbsource_mssql.models' - '.base_external_dbsource.pymssql') +ADAPTER = ( + "odoo.addons.base_external_dbsource_mssql.models" ".base_external_dbsource.pymssql" +) class TestBaseExternalDbsource(common.TransactionCase): - def setUp(self): super(TestBaseExternalDbsource, self).setUp() - self.dbsource = self.env.ref( - 'base_external_dbsource_mssql.demo_mssql', - ) + self.dbsource = self.env.ref("base_external_dbsource_mssql.demo_mssql") def test_connection_close_mssql(self): """ It should close the connection """ @@ -26,16 +23,14 @@ class TestBaseExternalDbsource(common.TransactionCase): def test_connection_open_mssql(self): """ It should call SQLAlchemy open """ with mock.patch.object( - self.dbsource, '_connection_open_sqlalchemy' + self.dbsource, "_connection_open_sqlalchemy" ) as parent_method: self.dbsource.connection_open_mssql() parent_method.assert_called_once_with() def test_excecute_mssql(self): """ It should pass args to SQLAlchemy execute """ - expect = 'sqlquery', 'sqlparams', 'metadata' - with mock.patch.object( - self.dbsource, '_execute_sqlalchemy' - ) as parent_method: + expect = "sqlquery", "sqlparams", "metadata" + with mock.patch.object(self.dbsource, "_execute_sqlalchemy") as parent_method: self.dbsource.execute_mssql(*expect) parent_method.assert_called_once_with(*expect)