Browse Source

May 15: [FIX] Bug Fixed 'customer_geolocation'

pull/320/head
RisvanaCybro 12 months ago
parent
commit
434ac8ee84
  1. 12
      customer_geolocation/controllers/main.py
  2. 8
      customer_geolocation/doc/RELEASE_NOTES.md
  3. 1
      customer_geolocation/views/portal_templates.xml

12
customer_geolocation/controllers/main.py

@ -36,7 +36,6 @@ class PortalGeolocation(CustomerPortal):
def account(self, **post):
""" Super CustomerPortal class function and pass the api key value
from settings using params to website view file"""
res = super(PortalGeolocation, self).account(**post)
params = request.env['ir.config_parameter'].sudo()
values = params.get_param('base_geolocalize.google_map_api_key')
@ -58,9 +57,8 @@ class PortalGeolocation(CustomerPortal):
the converted Latitude and longitude
"""
res = json.loads(coordinates)
geolocator = Nominatim(user_agent="geoapiExercises")
location = geolocator.reverse(
str(res.get('lat')) + "," + str(res.get('lng')))
geolocator = Nominatim(user_agent="my-app")
location = geolocator.reverse(f'{res.get("lat")},{res.get("lng")}')
city = "Undefined"
suburb = "Undefined"
state = "Undefined"
@ -98,11 +96,9 @@ class PortalGeolocation(CustomerPortal):
Pass the value to website view and set required fields and map
"""
locator = Nominatim(user_agent="myGeocoder")
locator = Nominatim(user_agent='my-app')
location = locator.geocode(address)
geolocator = Nominatim(user_agent="geoapiExercises")
location_country = geolocator.reverse(
str(location.latitude) + "," + str(location.longitude))
location_country = locator.reverse(f'{location.latitude},{location.longitude}')
addresses = location_country.raw['address']
country_code = addresses.get('country_code')
country = pytz.country_names[country_code]

8
customer_geolocation/doc/RELEASE_NOTES.md

@ -1,7 +1,13 @@
## Module <custmer_geolocation>
## Module <customer_geolocation>
#### 14.03.2023
#### Version 16.0.1.0.0
#### ADD
- Initial commit for Customer Geolocation
#### 09.05.2024
#### Version 16.0.1.0.1
#### BUG FIX
- Bug Fix for Customer Geolocation

1
customer_geolocation/views/portal_templates.xml

@ -134,7 +134,6 @@
$('#p_code').val(p_code);
$('#country_show').val(country);
$('#geo_state').val("2");
<!-- }-->
}
})
});

Loading…
Cancel
Save