From 22983c2b3bc6bf0e99ef02f4d00dd6e659148c0a Mon Sep 17 00:00:00 2001 From: Stefan Rijnhart Date: Tue, 16 Jan 2018 10:30:12 +0100 Subject: [PATCH] [FIX] Be less alarming about missing library (Module does not have to be installed) --- base_import_odoo/models/import_odoo_database.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/base_import_odoo/models/import_odoo_database.py b/base_import_odoo/models/import_odoo_database.py index f8e750a62..5869507bf 100644 --- a/base_import_odoo/models/import_odoo_database.py +++ b/base_import_odoo/models/import_odoo_database.py @@ -4,8 +4,10 @@ import logging try: import odoorpc -except: - logging.error('Unable to import odoorpc') +except ImportError: # pragma: no cover + logging.info('Unable to import odoorpc, used in base_import_odoo') + odoorpc = False + import psycopg2 import traceback from urlparse import urlparse @@ -572,6 +574,9 @@ class ImportOdooDatabase(models.Model): if len(hostport) == 1: hostport.append('80') host, port = hostport + if not odoorpc: # pragma: no cover + raise exceptions.UserError( + _('Please install the "odoorpc" libary in your environment')) remote = odoorpc.ODOO( host, protocol='jsonrpc+ssl' if url.scheme == 'https' else 'jsonrpc',