Browse Source

[FIX] do not raise error if pybarcode is not installed

pull/129/head
Sylvain LE GAL 8 years ago
parent
commit
0f40ba20a9
  1. 10
      barcodes_generate/models/barcode_generate_mixin.py

10
barcodes_generate/models/barcode_generate_mixin.py

@ -4,10 +4,18 @@
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain) # @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import barcode
import logging
from openerp import models, fields, api, exceptions 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): class barcode_generate_mixin(models.AbstractModel):
_name = 'barcode.generate.mixin' _name = 'barcode.generate.mixin'

Loading…
Cancel
Save