Hey, i am creating a widget that'll show a google maps, but i need to get elements of the one2many field where i am using it, i am not sure how to do that. Here's how i call the widget:
<field name="destins" string="Destinos" widget="test" colspan="4" nolabel="1" context="{'group_by':'fleet'}">
<tree>
<field name="coord"/>
<field name="fleet"/>
<field name="order"/>
</tree>
</field>
And this is the widget template:
<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
<t t-name="test">
<html>
<head>
<style>
#map_canvas{
width:500px;
height:500px;
}
</style>
</head>
<body>
<script>(function(d, s, id) {
var map;
function initialize(){
var chicago = new google.maps.LatLng(-40.321, 175.54);
var myOptions = {
zoom: 6,
mapTypeId: google.maps.MapTypeId.ROADMAP,
center: chicago
}
map = new google.maps.Map(d.getElementById("map_canvas"), myOptions);
//calcRoute();
}
function prepGoogleMaps(){
if(typeof google != 'undefined'){
initialize();
}else{
setTimeout(prepGoogleMaps,1000);
}
}
function loadGoogleMaps(){
var script_tag = document.createElement('script');
script_tag.setAttribute("type","text/javascript");
script_tag.setAttribute("src","http://maps.google.com/maps/api/js?sensor=false&callback=initialize");
(d.getElementsByTagName("head")[0] || d.documentElement).appendChild(script_tag);
prepGoogleMaps();
}
window.onload = loadGoogleMaps();
}(document, 'script', 'map-root'));</script>
<div id="map_canvas"></div>
</body>
</html>
</t>
</templates>
Showsa google maps, but i need to use coord field of one2many, can anybody help me do this?