From 2c028ca2a62ba8eee83ca55c79f6af3d16c0050e Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Mon, 19 Jul 2021 13:01:16 +0000 Subject: [PATCH] [FIX] http_routing: geoip longitude/latitude available In 2018 geoip2 support was added to allow the new database format that are freely available. But for these, only a subset of properties are available. Since Odoo 13 (August 2019), the sign module is using geoip latitude and longitude for logging access to sign module signatures, but this was only working for database using the first version of GeoIP databases. In other use case there would never be any geolocalization recorded. With this change, latitude and longitude are available in the session if the right module/database is installed. opw-2426323 closes odoo/odoo#73997 X-original-commit: 2be13b57749ac2c45de60717544c3061bbb29671 Signed-off-by: Christophe Simonis --- addons/http_routing/geoipresolver.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/http_routing/geoipresolver.py b/addons/http_routing/geoipresolver.py index 24bbe723d6d..2cd169524e6 100644 --- a/addons/http_routing/geoipresolver.py +++ b/addons/http_routing/geoipresolver.py @@ -55,6 +55,8 @@ class GeoIPResolver(object): 'city': r.city.name, 'country_code': getattr(country, attr), 'country_name': country.name, + 'latitude': r.location.latitude, + 'longitude': r.location.longitude, 'region': r.subdivisions[0].iso_code if r.subdivisions else None, 'time_zone': r.location.time_zone, }