The stock ``base_geocoder._call_openstreetmap`` sends a generic Odoo ``User-Agent`` shared across thousands of instances, which Nominatim rate-limits and blocks (HTTP 429 "Too many requests"), so mass geolocation fails regardless of client-side throttling. Override ``_call_openstreetmap`` to: - send a deployment-specific ``User-Agent`` read from a new system parameter ``partner_geolocalize_usability.user_agent`` (shipped with an obvious placeholder so an unconfigured instance fails loudly instead of silently reusing the banned generic agent); - throttle requests to one per second (``time.sleep``) before each call, complying with the Nominatim usage policy even when callers loop over many partners; - return ``None`` instead of raising ``IndexError`` when Nominatim returns an empty result for an unknown address. Document the required system parameter in the README and add tests covering the User-Agent selection, throttling and empty/blank results.
74 lines
2.1 KiB
ReStructuredText
74 lines
2.1 KiB
ReStructuredText
=============================
|
|
partner_geolocalize_usability
|
|
=============================
|
|
|
|
Brings several enhancements on geolocalize functionnalities
|
|
|
|
Installation
|
|
============
|
|
|
|
Use Odoo normal module installation procedure to install
|
|
``partner_geolocalize_usability``.
|
|
|
|
Description
|
|
===========
|
|
|
|
This module allows:
|
|
- to block or not the edition of partner_latitude and partner_longitude fields in partner form view.
|
|
- to massively trigger the geolocalize function
|
|
It also modify the partner form vieww for a better understanding of the geolocation data.
|
|
|
|
Configuration
|
|
=============
|
|
|
|
The OpenStreetMap Nominatim geocoding service requires a genuine, identifying
|
|
``User-Agent`` header with a valid contact address (see the `Nominatim usage
|
|
policy <https://operations.osmfoundation.org/policies/nominatim/>`_). The
|
|
default Odoo ``User-Agent`` is shared by many instances and gets rate-limited or
|
|
blocked (HTTP 429 "Too many requests").
|
|
|
|
To fix this, set the system parameter (Settings > Technical > System
|
|
Parameters):
|
|
|
|
- **Key**: ``partner_geolocalize_usability.user_agent``
|
|
- **Value**: a User-Agent identifying your deployment and a valid contact,
|
|
e.g. ``acme-crm/1.0 (contact: gis@acme.example)``
|
|
|
|
The module ships this parameter with a placeholder value; you MUST replace it
|
|
with your own, otherwise Nominatim will reject the requests.
|
|
|
|
Requests to Nominatim are additionally throttled to one request per second to
|
|
comply with the usage policy, so mass geolocation of many partners is slow by
|
|
design (roughly one partner per second).
|
|
|
|
Known issues / Roadmap
|
|
======================
|
|
|
|
None yet.
|
|
Bug Tracker
|
|
===========
|
|
|
|
Bugs are tracked on `our issues website <https://github.com/elabore-coop/partner-tools/issues>`_. In case of
|
|
trouble, please check there if your issue has already been
|
|
reported. If you spotted it first, help us smashing it by providing a
|
|
detailed and welcomed feedback.
|
|
|
|
Credits
|
|
=======
|
|
|
|
Contributors
|
|
------------
|
|
|
|
* Stéphan Sainléger
|
|
|
|
Funders
|
|
-------
|
|
|
|
The development of this module has been financially supported by:
|
|
* Elabore (https://elabore.coop)
|
|
|
|
|
|
Maintainer
|
|
----------
|
|
|
|
This module is maintained by Elabore. |