diff options
| author | Jeremy Kersten <jke@odoo.com> | 2019-07-04 10:24:00 +0000 |
|---|---|---|
| committer | Jeremy Kersten <jke@odoo.com> | 2019-07-04 13:08:42 +0000 |
| commit | 50d21df1561f660c184329cfc4cb567ea5d79ace (patch) | |
| tree | 7be0fb3cda27e4b0c35bf7f366425153b04ca919 /odoo/tools/misc.py | |
| parent | 3431751c1c854f9dbcfc2a91bf4238a36572ae1f (diff) | |
[FIX] base_geolocalize: allow to force country in request
Before this commit, using google geoloc, we only provide a string as address
withtout more information.
Now by defaut, we force the country as components:
https://developers.google.com/maps/documentation/geocoding/intro#geocoding
Related to task-2030886
**setup:**
```python
url = "https://maps.googleapis.com/maps/api/geocode/json"
```
**before:**
```python
params = {'address': 'Georgia', 'key': apikey}
requests.get(url, params).json()
```
> ==> Return coordinate of "Georgia, United States"
> What is completely wrong
>
**after:**
```python
params = {'address': 'Georgia', 'components':'country:Georgia', 'key': apikey}
requests.get(url, params).json()
```
> ==> Return Nothing
> What is strange but less wrong than US
>
```python
params = {'address': 'Belgium', 'components':'country:Belgium', 'key': apikey}
requests.get(url, params).json()
```
> ==> Return coordinate of Belgium
closes odoo/odoo#34582
Signed-off-by: Christophe Simonis <chs@odoo.com>
Diffstat (limited to 'odoo/tools/misc.py')
0 files changed, 0 insertions, 0 deletions
