diff --git a/account_invoice_import/wizard/account_invoice_import.py b/account_invoice_import/wizard/account_invoice_import.py index 1c85584456..8fcbe2a358 100644 --- a/account_invoice_import/wizard/account_invoice_import.py +++ b/account_invoice_import/wizard/account_invoice_import.py @@ -441,7 +441,6 @@ def _create_invoice(self, parsed_inv): @api.model def post_process_invoice(self, parsed_inv, invoice): - self.ensure_one() invoice.button_reset_taxes() # Force tax amount if necessary prec = self.env['decimal.precision'].precision_get('Account') diff --git a/account_invoice_import_invoice2data/wizard/account_invoice_import.py b/account_invoice_import_invoice2data/wizard/account_invoice_import.py index 6e23904332..73de4b6220 100644 --- a/account_invoice_import_invoice2data/wizard/account_invoice_import.py +++ b/account_invoice_import_invoice2data/wizard/account_invoice_import.py @@ -6,14 +6,17 @@ from openerp.exceptions import Warning as UserError import os from tempfile import mkstemp -import logging -from invoice2data.main import extract_data -from invoice2data.template import read_templates -from invoice2data.main import logger as loggeri2data import pkg_resources - +import logging logger = logging.getLogger(__name__) +try: + from invoice2data.main import extract_data + from invoice2data.template import read_templates + from invoice2data.main import logger as loggeri2data +except ImportError: + logger.debug('Cannot import invoice2data') + class AccountInvoiceImport(models.TransientModel): _inherit = 'account.invoice.import' diff --git a/account_invoice_zugferd/models/account_invoice.py b/account_invoice_zugferd/models/account_invoice.py index f105762a73..62ce7a5973 100644 --- a/account_invoice_zugferd/models/account_invoice.py +++ b/account_invoice_zugferd/models/account_invoice.py @@ -8,15 +8,19 @@ from openerp.tools import float_compare, float_is_zero, float_round from StringIO import StringIO from lxml import etree -from PyPDF2 import PdfFileWriter, PdfFileReader -from PyPDF2.generic import DictionaryObject, DecodedStreamObject,\ - NameObject, createStringObject, ArrayObject from tempfile import NamedTemporaryFile from datetime import datetime import logging -# from pprint import pprint - logger = logging.getLogger(__name__) + +try: + from PyPDF2 import PdfFileWriter, PdfFileReader + from PyPDF2.generic import DictionaryObject, DecodedStreamObject,\ + NameObject, createStringObject, ArrayObject +except ImportError: + logger.debug('Cannot import PyPDF2') + + ZUGFERD_LEVEL = 'comfort' ZUGFERD_FILENAME = 'ZUGFeRD-invoice.xml' diff --git a/base_business_document_import/models/business_document_import.py b/base_business_document_import/models/business_document_import.py index e69e0e0890..33ee3cdba4 100644 --- a/base_business_document_import/models/business_document_import.py +++ b/base_business_document_import/models/business_document_import.py @@ -5,15 +5,18 @@ from openerp import models, api, _ from openerp.tools import float_compare from openerp.exceptions import Warning as UserError -import PyPDF2 from lxml import etree from StringIO import StringIO import mimetypes from urlparse import urlparse import logging - logger = logging.getLogger(__name__) +try: + import PyPDF2 +except ImportError: + logger.debug('Cannot import PyPDF2') + class BusinessDocumentImport(models.AbstractModel): _name = 'business.document.import' diff --git a/base_business_document_import_phone/models/business_document_import.py b/base_business_document_import_phone/models/business_document_import.py index 8205e5458a..cc3cce593c 100644 --- a/base_business_document_import_phone/models/business_document_import.py +++ b/base_business_document_import_phone/models/business_document_import.py @@ -8,7 +8,7 @@ try: import phonenumbers except ImportError: - logger.warning('Cannot import phonenumbers') + logger.debug('Cannot import phonenumbers') class BusinessDocumentImport(models.AbstractModel): diff --git a/base_ubl/models/ubl.py b/base_ubl/models/ubl.py index 6163aa4ddb..4c9829b0c7 100644 --- a/base_ubl/models/ubl.py +++ b/base_ubl/models/ubl.py @@ -8,12 +8,15 @@ from lxml import etree from StringIO import StringIO from tempfile import NamedTemporaryFile -import PyPDF2 import mimetypes import logging - logger = logging.getLogger(__name__) +try: + import PyPDF2 +except ImportError: + logger.debug('Cannot import PyPDF2') + class BaseUbl(models.AbstractModel): _name = 'base.ubl' diff --git a/sale_order_import_csv/wizard/sale_order_import.py b/sale_order_import_csv/wizard/sale_order_import.py index df0198a30e..bfc2c0fe4c 100644 --- a/sale_order_import_csv/wizard/sale_order_import.py +++ b/sale_order_import_csv/wizard/sale_order_import.py @@ -6,10 +6,12 @@ from openerp.exceptions import Warning as UserError from openerp.tools import float_compare from tempfile import TemporaryFile -import unicodecsv import logging - logger = logging.getLogger(__name__) +try: + import unicodecsv +except ImportError: + logger.debug('Cannot import unicodecsv') class SaleOrderImport(models.TransientModel):