[FIX] base_geolocalize: geocode errors out on empty address
It's unclear whether that's a recent change or a long-standing issue, however currently if geocode is called with an empty address string it will reply with a 400 Bad Request, which gets raised as an exception and forwarded to the user. That is not a great experience. Shortcut the entire thing and just return None (= geolocation failed / no geolocation) on trying to geolocate an empty address. OPW-746686
This commit is contained in:
@@ -8,6 +8,8 @@ from odoo.exceptions import UserError
|
||||
|
||||
|
||||
def geo_find(addr):
|
||||
if not addr:
|
||||
return None
|
||||
url = 'https://maps.googleapis.com/maps/api/geocode/json?sensor=false&address='
|
||||
url += urllib2.quote(addr.encode('utf8'))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user