Browse Source

Merge pull request #105 from akretion/8.0-telephony-protect-import

8.0 Import phonenumbers protected by try/except
pull/118/head
Alexis de Lattre 8 years ago
committed by GitHub
parent
commit
0b00ade0f8
  1. 8
      base_phone/base_phone.py
  2. 9
      base_phone/report_sxw_format.py
  3. 6
      base_phone/wizard/number_not_found.py
  4. 9
      crm_phone/wizard/create_crm_phonecall.py

8
base_phone/base_phone.py

@ -23,11 +23,15 @@ from openerp import models, fields, api, _
from openerp.tools.safe_eval import safe_eval
from openerp.exceptions import Warning
import logging
# Lib for phone number reformating -> pip install phonenumbers
import phonenumbers
_logger = logging.getLogger(__name__)
# Lib for phone number reformating -> pip install phonenumbers
try:
import phonenumbers
except ImportError:
_logger.debug('Cannot import phonenumbers')
class PhoneCommon(models.AbstractModel):
_name = 'phone.common'

9
base_phone/report_sxw_format.py

@ -21,7 +21,14 @@
from openerp.osv import orm
from openerp.report import report_sxw
import phonenumbers
import logging
_logger = logging.getLogger(__name__)
try:
import phonenumbers
except ImportError:
_logger.debug('Cannot import phonenumbers')
class base_phone_installed(orm.AbstractModel):

6
base_phone/wizard/number_not_found.py

@ -22,10 +22,14 @@
from openerp.osv import orm, fields
from openerp.tools.translate import _
import logging
import phonenumbers
_logger = logging.getLogger(__name__)
try:
import phonenumbers
except ImportError:
_logger.debug('Cannot import phonenumbers')
class number_not_found(orm.TransientModel):
_name = "number.not.found"

9
crm_phone/wizard/create_crm_phonecall.py

@ -21,7 +21,14 @@
##############################################################################
from openerp import models, api, _
import phonenumbers
import logging
_logger = logging.getLogger(__name__)
try:
import phonenumbers
except ImportError:
_logger.debug('Cannot import phonenumbers')
class wizard_create_crm_phonecall(models.TransientModel):

Loading…
Cancel
Save