From 0f40ba20a90ed3e9f4dab4f89311544dbba2602e Mon Sep 17 00:00:00 2001 From: Sylvain LE GAL Date: Wed, 12 Oct 2016 17:36:49 +0200 Subject: [PATCH] [FIX] do not raise error if pybarcode is not installed --- barcodes_generate/models/barcode_generate_mixin.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/barcodes_generate/models/barcode_generate_mixin.py b/barcodes_generate/models/barcode_generate_mixin.py index 750ddd1b..43d9abf4 100644 --- a/barcodes_generate/models/barcode_generate_mixin.py +++ b/barcodes_generate/models/barcode_generate_mixin.py @@ -4,10 +4,18 @@ # @author: Sylvain LE GAL (https://twitter.com/legalsylvain) # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -import barcode +import logging from openerp import models, fields, api, exceptions +_logger = logging.getLogger(__name__) + +try: + import barcode +except ImportError: + _logger.debug("Cannot import 'barcode' python Librairy.") + barcode = None + class barcode_generate_mixin(models.AbstractModel): _name = 'barcode.generate.mixin'