Browse Source

[FIX] Be less alarming about missing library (Module does not have to be installed)

10.0
Stefan Rijnhart 7 years ago
committed by OCA-git-bot
parent
commit
81e613850c
  1. 9
      base_import_odoo/models/import_odoo_database.py

9
base_import_odoo/models/import_odoo_database.py

@ -4,8 +4,10 @@
import logging import logging
try: try:
import odoorpc 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 psycopg2
import traceback import traceback
from urlparse import urlparse from urlparse import urlparse
@ -572,6 +574,9 @@ class ImportOdooDatabase(models.Model):
if len(hostport) == 1: if len(hostport) == 1:
hostport.append('80') hostport.append('80')
host, port = hostport host, port = hostport
if not odoorpc: # pragma: no cover
raise exceptions.UserError(
_('Please install the "odoorpc" libary in your environment'))
remote = odoorpc.ODOO( remote = odoorpc.ODOO(
host, host,
protocol='jsonrpc+ssl' if url.scheme == 'https' else 'jsonrpc', protocol='jsonrpc+ssl' if url.scheme == 'https' else 'jsonrpc',

Loading…
Cancel
Save