diff --git a/base_location_nuts/__manifest__.py b/base_location_nuts/__manifest__.py
index f468bf9253bb..7b3787a98852 100644
--- a/base_location_nuts/__manifest__.py
+++ b/base_location_nuts/__manifest__.py
@@ -6,7 +6,7 @@
{
"name": "NUTS Regions",
"category": "Localisation/Europe",
- "version": "14.0.1.0.1",
+ "version": "16.0.1.0.0",
"depends": ["contacts"],
"data": [
"views/res_country_view.xml",
diff --git a/base_location_nuts/models/res_partner_nuts.py b/base_location_nuts/models/res_partner_nuts.py
index 2cbf14f91e50..ebdd1e3bc5b7 100644
--- a/base_location_nuts/models/res_partner_nuts.py
+++ b/base_location_nuts/models/res_partner_nuts.py
@@ -21,7 +21,7 @@ class ResPartnerNuts(models.Model):
not_updatable = fields.Boolean()
# Parent hierarchy
parent_id = fields.Many2one(comodel_name="res.partner.nuts", ondelete="restrict")
- parent_path = fields.Char(index=True)
+ parent_path = fields.Char(index=True, unaccent=False)
child_ids = fields.One2many(
comodel_name="res.partner.nuts", inverse_name="parent_id", string="Children"
)
diff --git a/base_location_nuts/tests/test_base_location_nuts.py b/base_location_nuts/tests/test_base_location_nuts.py
index 503888799e6e..9d7f3ffa6dde 100644
--- a/base_location_nuts/tests/test_base_location_nuts.py
+++ b/base_location_nuts/tests/test_base_location_nuts.py
@@ -5,7 +5,7 @@
from odoo.tests import common
-class TestBaseLocationNuts(common.SavepointCase):
+class TestBaseLocationNuts(common.TransactionCase):
@classmethod
def setUpClass(cls):
super(TestBaseLocationNuts, cls).setUpClass()
diff --git a/base_location_nuts/views/res_partner_nuts_view.xml b/base_location_nuts/views/res_partner_nuts_view.xml
index bbda3e6452ae..7d1f46bb2547 100644
--- a/base_location_nuts/views/res_partner_nuts_view.xml
+++ b/base_location_nuts/views/res_partner_nuts_view.xml
@@ -4,7 +4,7 @@
NUTS Items tree
res.partner.nuts
-
+
diff --git a/base_location_nuts/wizard/nuts_import.py b/base_location_nuts/wizard/nuts_import.py
index 12c74d3f6fb4..f1ba33e0abd4 100644
--- a/base_location_nuts/wizard/nuts_import.py
+++ b/base_location_nuts/wizard/nuts_import.py
@@ -8,7 +8,7 @@
import re
from collections import OrderedDict
-import requests
+import urllib3
from lxml import etree
from odoo import _, api, fields, models
@@ -121,7 +121,7 @@ def _mapping(self, node):
else:
logger.debug("xpath = '%s', not found" % field_xpath)
if field_required and not value:
- raise UserError(_("Value not found for mandatory field %s" % k))
+ raise UserError(_("Value not found for mandatory field %s") % k)
item[k] = value
return item
@@ -136,20 +136,24 @@ def _download_nuts(self, url_base=None, url_path=None, url_params=None):
url += "&".join([k + "=" + v for k, v in url_params.items()])
logger.info("Starting to download %s" % url)
try:
- res_request = requests.get(url)
+ http = urllib3.PoolManager()
+ res_request = http.request("GET", url)
except Exception as e:
raise UserError(
_("Got an error when trying to download the file: %s.") % str(e)
- )
- if res_request.status_code != requests.codes.ok:
+ ) from e
+ if res_request.status != 200:
raise UserError(
- _("Got an error %d when trying to download the file %s.")
- % (res_request.status_code, url)
+ _(
+ "Got an error %(d)s when trying to download the file %(s)s.",
+ d=res_request.status,
+ s=url,
+ )
)
- logger.info("Download successfully %d bytes" % len(res_request.content))
+ logger.info("Download successfully %d bytes" % len(res_request.data))
# Workaround XML: Remove all characters before