Hello everyone, I am developing a website with controllers, I want to show a map with google maps api javascript for each client, the coordinates of the clients I have in res.partner, how can I pass this data to javascript?. For example
I have next code in the xml and works but the latitude and longitude is fixed
<div id="map"></div><script src="https://maps.googleapis.com/maps/api/js?key=Api&callback=initMap"
async="async" defer="defer"></script>
<script>
var map;
function initMap() {
map = new google.maps.Map(document.getElementById('map'), {
center: {lat: 19.3620379, lng: -99.130065},
zoom: 12,
});
var marker = new google.maps.Marker({
position: {lat: 19.3812391, lng: -99.2041034},
map: map,
title: 'Lueste'
});
}
</script>I want the coordinates to be obtained from the database, between several attempts, I tried with something like this.Delivery is label from my model.position: {lat: <span t-value="delivery.partner_latitude()"/>, lng:<span t-value="delivery.partner_longitude()"/> },
Orposition: {lat: $( "delivery.partner_latitude" ).val(), lng: $( "delivery.partner_longitude" ).val()},
class Logistics(http.Controller):
@http.route('/logistics/token=<model("logistics.concretedelivery"):delivery>', type='http', auth='public', website=True)
def logis_home_token(self, delivery, **kwargs):
return request.render('logistics.logistics_website', {
"delivery": delivery})
Do you have any suggestions on how to pass the parameters to it? Thank you very much for reading and giving me advice.