[FIX] base_vat_autocomplete: add compatibility with python-stdnum>=1.9

The `country_codes` variable was replaced by `_country_codes` at
arthurdejong/python-stdnum@c113613b70

Make sure the syntax is the same

Closes #24395
This commit is contained in:
Moisés López
2018-04-25 11:04:31 +02:00
committed by Martin Trigaux
parent 019c8b9975
commit c2fec7ed88
@@ -12,6 +12,9 @@ _logger = logging.getLogger(__name__)
try:
import stdnum.eu.vat as stdnum_vat
if not hasattr(stdnum_vat, "country_codes"):
# stdnum version >= 1.9
stdnum_vat.country_codes = stdnum_vat._country_codes
except ImportError:
_logger.warning('Python `stdnum` library not found, unable to call VIES service to detect address based on VAT number.')
stdnum_vat = None