From 7c46c634212eaa4995e9a2a68f55cd6ab414d133 Mon Sep 17 00:00:00 2001 From: "David Alonso (Solvos)" Date: Tue, 1 Sep 2020 19:06:26 +0200 Subject: [PATCH] [MIG] base_external_dbsource_mysql: Migration to 13.0 [UPD] Update base_external_dbsource_mysql.pot [UPD] README.rst --- base_external_dbsource_mysql/README.rst | 11 ++++---- base_external_dbsource_mysql/__manifest__.py | 10 +++---- .../i18n/base_external_dbsource_mysql.pot | 7 +++-- .../models/base_external_dbsource.py | 27 +++---------------- .../readme/CONTRIBUTORS.rst | 1 + .../static/description/index.html | 9 ++++--- .../tests/test_base_external_dbsource.py | 4 +-- 7 files changed, 25 insertions(+), 44 deletions(-) diff --git a/base_external_dbsource_mysql/README.rst b/base_external_dbsource_mysql/README.rst index a0948436..96f16401 100644 --- a/base_external_dbsource_mysql/README.rst +++ b/base_external_dbsource_mysql/README.rst @@ -14,13 +14,13 @@ External Database Source - MySQL :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/12.0/base_external_dbsource_mysql + :target: https://github.com/OCA/server-backend/tree/13.0/base_external_dbsource_mysql :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-12-0/server-backend-12-0-base_external_dbsource_mysql + :target: https://translation.odoo-community.org/projects/server-backend-13-0/server-backend-13-0-base_external_dbsource_mysql :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/12.0 + :target: https://runbot.odoo-community.org/runbot/253/13.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -73,7 +73,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. @@ -94,6 +94,7 @@ Contributors * Gervais Naoussi * Dave Lasley * Sergio Teruel +* David Alonso Maintainers ~~~~~~~~~~~ @@ -108,6 +109,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_mysql/__manifest__.py b/base_external_dbsource_mysql/__manifest__.py index 0c0f2df7..0d395371 100644 --- a/base_external_dbsource_mysql/__manifest__.py +++ b/base_external_dbsource_mysql/__manifest__.py @@ -3,13 +3,13 @@ # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). { "name": "External Database Source - MySQL", - "version": "12.0.1.0.0", + "version": "13.0.1.0.0", "category": "Tools", - "author": "Daniel Reis, " "LasLabs, " "Odoo Community Association (OCA)", + "author": "Daniel Reis, LasLabs, Odoo Community Association (OCA)", "website": "https://github.com/OCA/server-backend", "license": "LGPL-3", - "depends": ["base_external_dbsource",], - "external_dependencies": {"python": ["sqlalchemy", "MySQLdb",],}, - "demo": ["demo/base_external_dbsource.xml",], + "depends": ["base_external_dbsource"], + "external_dependencies": {"python": ["sqlalchemy", "mysqlclient"]}, + "demo": ["demo/base_external_dbsource.xml"], "installable": True, } diff --git a/base_external_dbsource_mysql/i18n/base_external_dbsource_mysql.pot b/base_external_dbsource_mysql/i18n/base_external_dbsource_mysql.pot index 4ba76b61..f5f38d71 100644 --- a/base_external_dbsource_mysql/i18n/base_external_dbsource_mysql.pot +++ b/base_external_dbsource_mysql/i18n/base_external_dbsource_mysql.pot @@ -1,12 +1,12 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * base_external_dbsource_mysql +# * base_external_dbsource_mysql # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 12.0\n" +"Project-Id-Version: Odoo Server 13.0\n" "Report-Msgid-Bugs-To: \n" -"Last-Translator: <>\n" +"Last-Translator: \n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -17,4 +17,3 @@ msgstr "" #: model:ir.model,name:base_external_dbsource_mysql.model_base_external_dbsource msgid "External Database Sources" msgstr "" - diff --git a/base_external_dbsource_mysql/models/base_external_dbsource.py b/base_external_dbsource_mysql/models/base_external_dbsource.py index 3b6dd0ce..32f367c8 100644 --- a/base_external_dbsource_mysql/models/base_external_dbsource.py +++ b/base_external_dbsource_mysql/models/base_external_dbsource.py @@ -2,34 +2,13 @@ # Copyright 2016 LasLabs Inc. # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). -import logging +import sqlalchemy from odoo import models -_logger = logging.getLogger(__name__) +from odoo.addons.base_external_dbsource.models import base_external_dbsource -try: - from odoo.addons.base_external_dbsource.models import base_external_dbsource - - CONNECTORS = base_external_dbsource.BaseExternalDbsource.CONNECTORS - try: - import MySQLdb - - CONNECTORS.append(("mysql", "MySQL")) - assert MySQLdb - except (ImportError, AssertionError): - _logger.info( - 'MySQLdb not available. Please install "mysqlclient" ' "python package." - ) - try: - import sqlalchemy - except ImportError: - _logger.info( - "SQLAlchemy library not available. Please " - 'install "sqlalchemy" python package.' - ) -except ImportError: - _logger.info("base_external_dbsource Odoo module not found.") +base_external_dbsource.BaseExternalDbsource.CONNECTORS.append(("mysql", "MySQL")) class BaseExternalDbsource(models.Model): diff --git a/base_external_dbsource_mysql/readme/CONTRIBUTORS.rst b/base_external_dbsource_mysql/readme/CONTRIBUTORS.rst index aea7525a..49c84834 100644 --- a/base_external_dbsource_mysql/readme/CONTRIBUTORS.rst +++ b/base_external_dbsource_mysql/readme/CONTRIBUTORS.rst @@ -3,3 +3,4 @@ * Gervais Naoussi * Dave Lasley * Sergio Teruel +* David Alonso diff --git a/base_external_dbsource_mysql/static/description/index.html b/base_external_dbsource_mysql/static/description/index.html index 9c98115f..a488744f 100644 --- a/base_external_dbsource_mysql/static/description/index.html +++ b/base_external_dbsource_mysql/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 MySQL databases using SQLAlchemy.

Table of contents

@@ -408,7 +408,7 @@ Database Structure > Database sources.
  • Go to Settings > Technical > Database Structure > Database Sources
  • Click on Create to enter the following information:
  • -
  • Datasource name
  • +
  • Datasource name??
  • Pasword
  • Connector: Choose the database to which you want to connect
  • Connection string: Specify how to connect to database
  • @@ -425,7 +425,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,6 +445,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
  • Gervais Naoussi <gervaisnaoussi@gmail.com>
  • Dave Lasley <dave@laslabs.com>
  • Sergio Teruel <sergio.teruel@tecnativa.com>
  • +
  • David Alonso <david.alonso@solvos.es>
@@ -454,7 +455,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_mysql/tests/test_base_external_dbsource.py b/base_external_dbsource_mysql/tests/test_base_external_dbsource.py index 0151440a..f45eb03b 100644 --- a/base_external_dbsource_mysql/tests/test_base_external_dbsource.py +++ b/base_external_dbsource_mysql/tests/test_base_external_dbsource.py @@ -5,14 +5,14 @@ import mock from odoo.tests import common ADAPTER = ( - "odoo.addons.base_external_dbsource_mysql.models" ".base_external_dbsource.MySQLdb" + "odoo.addons.base_external_dbsource_mysql.models.base_external_dbsource.MySQLdb" ) class TestBaseExternalDbsource(common.TransactionCase): def setUp(self): super(TestBaseExternalDbsource, self).setUp() - self.dbsource = self.env.ref("base_external_dbsource_mysql.demo_mysql",) + self.dbsource = self.env.ref("base_external_dbsource_mysql.demo_mysql") def test_connection_close_mysql(self): """ It should close the connection """