Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] base_geolocalize: raise a helpful error to configure the Google… #32162

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
24 changes: 23 additions & 1 deletion addons/base_geolocalize/i18n/base_geolocalize.pot
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,17 @@ msgid "<span> ; Long: </span>"
msgstr ""

#. module: base_geolocalize
#: code:addons/base_geolocalize/models/res_partner.py:17
#: code:addons/base_geolocalize/models/res_partner.py:18
#, python-format
msgid "API key for GeoCoding (Places) required.\n"
"\n"
" Save this key in System Parameters with key: google.api_key_geocode, value: <your api key>\n"
" Visit https://developers.google.com/maps/documentation/geocoding/get-api-key for more information.\n"
" "
msgstr ""

#. module: base_geolocalize
#: code:addons/base_geolocalize/models/res_partner.py:29
#, python-format
msgid "Cannot contact geolocation servers. Please make sure that your Internet connection is up and running (%s)."
msgstr ""
Expand Down Expand Up @@ -71,3 +81,15 @@ msgstr ""
msgid "Partner Assignation"
msgstr ""

#. module: base_geolocalize
#: code:addons/base_geolocalize/models/res_partner.py:34
#, python-format
msgid "Unable to geolocate, received the error:\n"
"%s\n"
"\n"
"Google made this a paid feature.\n"
"You should first enable billing on your Google account.\n"
"Then, go to Developer Console, and enable the APIs:\n"
"Geocoding, Maps Static, Maps Javascript.\n"
"error_message"
msgstr ""
8 changes: 7 additions & 1 deletion addons/base_geolocalize/models/res_partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,13 @@ def geo_find(addr, apikey=False):
if result['status'] != 'OK':
if result.get('error_message'):
_logger.error(result['error_message'])
return None
error_msg = _('Unable to geolocate, received the error:\n%s'
'\n\nGoogle made this a paid feature.\n'
'You should first enable billing on your Google account.\n'
'Then, go to Developer Console, and enable the APIs:\n'
'Geocoding, Maps Static, Maps Javascript.\n'
% result['error_message'])
raise UserError(error_msg)

try:
geo = result['results'][0]['geometry']['location']
Expand Down