[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 <chs@odoo.com>
This commit is contained in:
Nicolas Lempereur
2021-07-19 18:49:19 +00:00
parent 3fad7a39ea
commit 2c028ca2a6
+2
View File
@@ -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,
}