odoo/enterprise#27399
Created by SM Learn, Julien Castiaux (juc)
Merged
at bc80577c6a95b07effc5bf9fe6c78cdedf96ba88
Statuses:
- legal/cla: Contributor License Agreement check
- ci/runbot: Odoo Test Suite
- ci/upgrade_enterprise: Test upgrades for enterprise master
- ci/style: Optional style check. Ignore it only if strictly necessary.
- ci/security: Required security check. Can only be ignored by security team.
- ci/l10n: (runtime 44s)
Linked pull requests
- label
- odoo-dev:master-smarter_geoip-juc
- head
- 9306b5e48a87d3fe9cf7153f500dd6057248c87f
- merged
- 3 years ago by SM Learn, Julien Castiaux (juc)
| odoo/odoo | odoo/enterprise | odoo/documentation | |
|---|---|---|---|
| master | #91337 | #27399 | #2151 |
[IMP] *: update modules to use the new geoip API
request.geoip is no more a dictionnary cached in the session. It is now
a full blown object with lazy and smart geolocalisation capabilities.
Among other things, the previous dictionnary API is now deprecated. The
changes are:
request.geoip['country_name']->request.geoip.country_namerequest.geoip['country_code']->request.geoip.country_coderequest.geoip['city']->request.geoip.city.namerequest.geoip['latitude']->request.geoip.location.latituderequest.geoip['longitude']->request.geoip.location.longituderequest.geoip['region']->(request.geoip.subdivisions[0].iso_code if request.geoip.subdivisions else None)request.geoip['time_zone']->request.geoip.location.time_zone
It is safe to access all the attributes. Doing request.geoip.city.name
when the geolocalization failed (missing db, invalid address, ...)
evaluates to None. It does not raise an AttributeError.
Related to odoo/odoo#91337