Commit Graph
12 Commits
Author SHA1 Message Date
Xavier Morel 9ebbfdac73 [FIX] *: incorrect translations markings
Fixes a large number of cases where strings are translated then
formatted, instead of letting `_()` do the formatting internally,
which allows it to recover from incorrect translations (missing,
broken, or extra placeholders).

Also

- removes translation markers entirely when there's nothing to
  translate e.g. `_("%s - %s")` is not useful
- fixes a few messes which lead to only partial translatability
  (DRY is generally a bad idea when translations are involved, even
  more so when you don't make the variable part translatable)
- fixes a few nearby issues noticed at the same time
- replaces a few `"%s"` by `%r`, which should automatically quote
  strings relatively appropriately
- fixes translated strings which use `\` to escape a newline (in order
  to fill-paragraph): `\` escapes only the newline, if the
  continuation string is indented this results in a bunch of spaces
  ending in the string to translate, which is pretty garbage for the
  translator, using implicit concatenation works much better

Note: some of the updates revert f-string parameters to %, because
babel (2.9) apparently has trouble with f-strings and blows up trying
to extract them.

Not in scope:

Helping translators fix translatable strings e.g. any translation
string with more than one placeholder probably should use keyword
placeholders

- Provides more context / data to the translator to make sense of the
  sentence.
- Allows reordering the translated terms, which can be necessary
  depending on the sentence and language.

closes odoo/odoo#139314

Related: odoo/enterprise#49311
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2023-10-23 16:45:09 +00:00
Arnaud Joset 24d63c1474 [REV] base_geolocalize: revert useragent selection
The commit  https://github.com/odoo/odoo/commit/160e8bfbf72a3e5d7cc8d8cbe7bc4f310f298baa introduced a way to update the
useragent used to request openstreetmap nominatim service.

It was introduced as a bad fix to prevent an erroneous blacklist from the
service. Once the blacklist has been removed, this fix was not necessary
anymore. It also allows to abuse the free service which is against the
osmfoundation policy. The best solution would be to decrease the amount of
request. The Google Place Map service is also available to avoid using the
openstreetmap service with large database.

closes odoo/odoo#138078

X-original-commit: 2726d2724e06e5818eaf2d0010971554372c4727
Signed-off-by: Arnaud Joset (arj) <arj@odoo.com>
2023-10-10 07:15:45 +00:00
Arnaud Joset be3794ad72 [FIX] base_geolocalize: allow using the functionnality without privileges.
Before this commit, simple user could not use the novatim API since https://github.com/odoo/odoo/commit/160e8bfbf72a3e5d7cc8d8cbe7bc4f310f298baa

closes odoo/odoo#134757

Taskid: 3497580
X-original-commit: 4376361854e6e4e0e87f1f280fbd68ee1595369d
Signed-off-by: Arnaud Joset (arj) <arj@odoo.com>
2023-09-08 01:46:53 +00:00
Arnaud Joset 5f16ea36d6 [FIX] base_geolocalize: allow to override user agent with system parameter
Before this commit, the useragent was harcoded as an Odoo one and if it was
blacklisted by the osmfoundation policy https://operations.osmfoundation.org/policies/nominatim/
all Odoo instances were forbidden to access the service.

This parameter allows to override the user agent with a system parameter.

closes odoo/odoo#134376

X-original-commit: 160e8bfbf72a3e5d7cc8d8cbe7bc4f310f298baa
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Signed-off-by: Arnaud Joset (arj) <arj@odoo.com>
2023-09-06 13:25:29 +00:00
Saurabh Choraria 2a9d0ce128 [FIX] base_geolocalize: update log when request to openstreetmap fails
When the user will not get an HTTP response as 200 while retrieving the location
using OpenStreetMap Nominatim service, the logger error will occur.

The logger is updated to use the 'warning' level instead of the 'error' level.
This change reflects a less severe logging level for cases where a request to
OpenStreetMap fails.

sentry-4151622143

closes odoo/odoo#125835

X-original-commit: a73a65efc0daa702b6a3fd40ad63d2ef39ace302
Signed-off-by: Julien Castiaux (juc) <juc@odoo.com>
2023-06-21 15:53:15 +02:00
niyasraphy d9281dcaec [IMP] base_geolocalize : form view for base.geo_provider model
closes odoo/odoo#106374

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-01-16 19:45:52 +01:00
qho 4496ce31aa [FIX] base_geolocalize: access blocked by OpenStreetMap
The geolocation service from OpenStreetMap will not be unblocked until a
'meaningful' and identical user-agent added in the request.

opw-2221857

closes odoo/odoo#48805

X-original-commit: 9018039b835547ea4adbc32a23901214613a033a
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-04-01 21:22:04 +00:00
Jeremy Kersten 50d21df156 [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>
2019-07-04 13:08:42 +00:00
Jeremy Kersten a5b1a288a6 [FIX] base_geolocalize: handle ZERO_RESULTS as google response
Before this commit, it was considered as an error because status was not OK

closes odoo/odoo#34377

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2019-06-26 10:00:59 +00:00
Christophe Simonis d32420397d [MERGE] forward port branch 12.0 up to 251021796c 2019-04-04 11:20:03 +02:00
Jeremy Kersten 6c67539b92 [REF] base_geolocalize, base_setup: ref + make it configurable in settings
Migrate in v12 and Refactor a part of the code
Allow to configure it in setting
2018-11-16 16:24:49 +00:00
Emanuel Cino 0fda77e777 [FIX] base_geolocalize allow to use Openstreetmap instead of Google
- Change API provider to prevent invalid API calls
- Move geo_find methods into base.geocoder object to ease inheritance
- Add system parameter to allow use of another provider

fixes #x26924
fixes #x6929
2018-11-15 18:13:46 +00:00