[MIG] base_external_dbsource: Migration to v15.0

TT37273
This commit is contained in:
Carlos Dauden
2022-08-30 16:28:04 +02:00
committed by Andrea Cattalani
parent afe106fcda
commit 1829a38b86
7 changed files with 37 additions and 27 deletions

View File

@@ -14,13 +14,13 @@ External Database Sources
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3 :alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--backend-lightgray.png?logo=github .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--backend-lightgray.png?logo=github
:target: https://github.com/OCA/server-backend/tree/14.0/base_external_dbsource :target: https://github.com/OCA/server-backend/tree/15.0/base_external_dbsource
:alt: OCA/server-backend :alt: OCA/server-backend
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/server-backend-14-0/server-backend-14-0-base_external_dbsource :target: https://translation.odoo-community.org/projects/server-backend-15-0/server-backend-15-0-base_external_dbsource
:alt: Translate me on Weblate :alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/253/14.0 :target: https://runbot.odoo-community.org/runbot/253/15.0
:alt: Try me on Runbot :alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5| |badge1| |badge2| |badge3| |badge4| |badge5|
@@ -75,7 +75,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/server-backend/issues>`_. Bugs are tracked on `GitHub Issues <https://github.com/OCA/server-backend/issues>`_.
In case of trouble, please check there if your issue has already been reported. 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 If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/server-backend/issues/new?body=module:%20base_external_dbsource%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. `feedback <https://github.com/OCA/server-backend/issues/new?body=module:%20base_external_dbsource%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Do not contact contributors directly about support or help with technical issues. Do not contact contributors directly about support or help with technical issues.
@@ -95,8 +95,11 @@ Contributors
* Maxime Chambreuil <maxime.chambreuil@savoirfairelinux.com> * Maxime Chambreuil <maxime.chambreuil@savoirfairelinux.com>
* Gervais Naoussi <gervaisnaoussi@gmail.com> * Gervais Naoussi <gervaisnaoussi@gmail.com>
* Dave Lasley <dave@laslabs.com> * Dave Lasley <dave@laslabs.com>
* Sergio Teruel <sergio.teruel@tecnativa.com> (https://wwww.tecnativa.com)
* Jairo Llopis <jairo.llopis@tecnativa.com> (https://wwww.tecnativa.com) * `Tecnativa <https://www.tecnativa.com>`_:
* Sergio Teruel
* Jairo Llopis
Maintainers Maintainers
~~~~~~~~~~~ ~~~~~~~~~~~
@@ -111,6 +114,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and mission is to support the collaborative development of Odoo features and
promote its widespread use. promote its widespread use.
This module is part of the `OCA/server-backend <https://github.com/OCA/server-backend/tree/14.0/base_external_dbsource>`_ project on GitHub. This module is part of the `OCA/server-backend <https://github.com/OCA/server-backend/tree/15.0/base_external_dbsource>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@@ -3,7 +3,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{ {
"name": "External Database Sources", "name": "External Database Sources",
"version": "14.0.1.0.1", "version": "15.0.1.0.0",
"category": "Tools", "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", "website": "https://github.com/OCA/server-backend",

View File

@@ -63,13 +63,12 @@ class BaseExternalDbsource(models.Model):
default=lambda self: self.env.user.company_id, default=lambda self: self.env.user.company_id,
) )
conn_string_full = fields.Text(readonly=True, compute="_compute_conn_string_full") conn_string_full = fields.Text(readonly=True, compute="_compute_conn_string_full")
password = fields.Char("Password") password = fields.Char()
client_cert = fields.Text() client_cert = fields.Text()
client_key = fields.Text() client_key = fields.Text()
ca_certs = fields.Char(help="Path to CA Certs file on server.") ca_certs = fields.Char(help="Path to CA Certs file on server.")
connector = fields.Selection( connector = fields.Selection(
CONNECTORS, CONNECTORS,
"Connector",
required=True, required=True,
help="If a connector is missing from the list, check the server " help="If a connector is missing from the list, check the server "
"log to confirm that the required components were detected.", "log to confirm that the required components were detected.",
@@ -151,12 +150,12 @@ class BaseExternalDbsource(models.Model):
try: try:
query = kwargs["sqlquery"] query = kwargs["sqlquery"]
except KeyError: except KeyError:
raise TypeError(_("query is a required argument")) raise TypeError(_("query is a required argument")) from KeyError
if not execute_params: if not execute_params:
try: try:
execute_params = kwargs["sqlparams"] execute_params = kwargs["sqlparams"]
except KeyError: except KeyError as e:
pass _logger.debug(e)
method = self._get_adapter_method("execute") method = self._get_adapter_method("execute")
rows, cols = method(query, execute_params, metadata) rows, cols = method(query, execute_params, metadata)
@@ -179,7 +178,7 @@ class BaseExternalDbsource(models.Model):
raise ValidationError( raise ValidationError(
_("Connection test failed:\n" "Here is what we got instead:\n%s") _("Connection test failed:\n" "Here is what we got instead:\n%s")
% tools.ustr(e) % tools.ustr(e)
) ) from e
raise ValidationError( raise ValidationError(
_("Connection test succeeded:\n" "Everything seems properly set up!") _("Connection test succeeded:\n" "Everything seems properly set up!")
) )
@@ -330,7 +329,9 @@ class BaseExternalDbsource(models.Model):
except AttributeError: except AttributeError:
raise NotImplementedError( raise NotImplementedError(
_( _(
'"%s" method not found, check that all assets are installed ' '"%(method)s" method not found, check that all assets are installed '
"for the %s connector type." "for the %(connector)s connector type.",
method=method,
conector=self.connector,
) )
) % (method, self.connector) ) from AttributeError

View File

@@ -2,5 +2,8 @@
* Maxime Chambreuil <maxime.chambreuil@savoirfairelinux.com> * Maxime Chambreuil <maxime.chambreuil@savoirfairelinux.com>
* Gervais Naoussi <gervaisnaoussi@gmail.com> * Gervais Naoussi <gervaisnaoussi@gmail.com>
* Dave Lasley <dave@laslabs.com> * Dave Lasley <dave@laslabs.com>
* Sergio Teruel <sergio.teruel@tecnativa.com> (https://wwww.tecnativa.com)
* Jairo Llopis <jairo.llopis@tecnativa.com> (https://wwww.tecnativa.com) * `Tecnativa <https://www.tecnativa.com>`_:
* Sergio Teruel
* Jairo Llopis

View File

@@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.15.1: http://docutils.sourceforge.net/" /> <meta name="generator" content="Docutils: http://docutils.sourceforge.net/" />
<title>External Database Sources</title> <title>External Database Sources</title>
<style type="text/css"> <style type="text/css">
@@ -367,7 +367,7 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !! !! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !! !! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/licence-LGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/server-backend/tree/14.0/base_external_dbsource"><img alt="OCA/server-backend" src="https://img.shields.io/badge/github-OCA%2Fserver--backend-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/server-backend-14-0/server-backend-14-0-base_external_dbsource"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/253/14.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p> <p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/licence-LGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/server-backend/tree/15.0/base_external_dbsource"><img alt="OCA/server-backend" src="https://img.shields.io/badge/github-OCA%2Fserver--backend-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/server-backend-15-0/server-backend-15-0-base_external_dbsource"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/253/15.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>This module allows you to define connections to foreign databases using ODBC, <p>This module allows you to define connections to foreign databases using ODBC,
Firebird, Oracle Client or SQLAlchemy.</p> Firebird, Oracle Client or SQLAlchemy.</p>
<p><strong>Table of contents</strong></p> <p><strong>Table of contents</strong></p>
@@ -427,7 +427,7 @@ support larger datasets in a more efficient manner.</li>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/server-backend/issues">GitHub Issues</a>. <p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/server-backend/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported. 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 If you spotted it first, help us smashing it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/server-backend/issues/new?body=module:%20base_external_dbsource%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p> <a class="reference external" href="https://github.com/OCA/server-backend/issues/new?body=module:%20base_external_dbsource%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p> <p>Do not contact contributors directly about support or help with technical issues.</p>
</div> </div>
<div class="section" id="credits"> <div class="section" id="credits">
@@ -446,8 +446,11 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<li>Maxime Chambreuil &lt;<a class="reference external" href="mailto:maxime.chambreuil&#64;savoirfairelinux.com">maxime.chambreuil&#64;savoirfairelinux.com</a>&gt;</li> <li>Maxime Chambreuil &lt;<a class="reference external" href="mailto:maxime.chambreuil&#64;savoirfairelinux.com">maxime.chambreuil&#64;savoirfairelinux.com</a>&gt;</li>
<li>Gervais Naoussi &lt;<a class="reference external" href="mailto:gervaisnaoussi&#64;gmail.com">gervaisnaoussi&#64;gmail.com</a>&gt;</li> <li>Gervais Naoussi &lt;<a class="reference external" href="mailto:gervaisnaoussi&#64;gmail.com">gervaisnaoussi&#64;gmail.com</a>&gt;</li>
<li>Dave Lasley &lt;<a class="reference external" href="mailto:dave&#64;laslabs.com">dave&#64;laslabs.com</a>&gt;</li> <li>Dave Lasley &lt;<a class="reference external" href="mailto:dave&#64;laslabs.com">dave&#64;laslabs.com</a>&gt;</li>
<li>Sergio Teruel &lt;<a class="reference external" href="mailto:sergio.teruel&#64;tecnativa.com">sergio.teruel&#64;tecnativa.com</a>&gt; (<a class="reference external" href="https://wwww.tecnativa.com">https://wwww.tecnativa.com</a>)</li> <li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:<ul>
<li>Jairo Llopis &lt;<a class="reference external" href="mailto:jairo.llopis&#64;tecnativa.com">jairo.llopis&#64;tecnativa.com</a>&gt; (<a class="reference external" href="https://wwww.tecnativa.com">https://wwww.tecnativa.com</a>)</li> <li>Sergio Teruel</li>
<li>Jairo Llopis</li>
</ul>
</li>
</ul> </ul>
</div> </div>
<div class="section" id="maintainers"> <div class="section" id="maintainers">
@@ -457,7 +460,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose <p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and mission is to support the collaborative development of Odoo features and
promote its widespread use.</p> promote its widespread use.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/server-backend/tree/14.0/base_external_dbsource">OCA/server-backend</a> project on GitHub.</p> <p>This module is part of the <a class="reference external" href="https://github.com/OCA/server-backend/tree/15.0/base_external_dbsource">OCA/server-backend</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p> <p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div> </div>
</div> </div>

View File

@@ -1,6 +1,6 @@
# Copyright 2016 LasLabs Inc. # Copyright 2016 LasLabs Inc.
import mock from unittest import mock
from odoo.sql_db import connection_info_for from odoo.sql_db import connection_info_for
from odoo.tests import common from odoo.tests import common

View File

@@ -6,7 +6,7 @@
<field name="model">base.external.dbsource</field> <field name="model">base.external.dbsource</field>
<field name="type">tree</field> <field name="type">tree</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<tree string="External DB Sources"> <tree>
<field name="name" /> <field name="name" />
<field name="connector" /> <field name="connector" />
<field name="conn_string" /> <field name="conn_string" />