From c2fec7ed885ca25db29e64f2439ab4d29728294c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mois=C3=A9s=20L=C3=B3pez?= Date: Tue, 24 Apr 2018 08:55:15 -0500 Subject: [PATCH] [FIX] base_vat_autocomplete: add compatibility with python-stdnum>=1.9 The `country_codes` variable was replaced by `_country_codes` at arthurdejong/python-stdnum@c113613b70629a6ba92dcc0afc9dbf834f5179ee Make sure the syntax is the same Closes #24395 --- addons/base_vat_autocomplete/models/res_partner.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/addons/base_vat_autocomplete/models/res_partner.py b/addons/base_vat_autocomplete/models/res_partner.py index 93d74c497f8..f62c2e53b8c 100644 --- a/addons/base_vat_autocomplete/models/res_partner.py +++ b/addons/base_vat_autocomplete/models/res_partner.py @@ -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