Siirry sisältöön
Menu
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Tämä kysymys on merkitty

How can i get the Geolocation of the user with lattitude and longitude when he fills the timesheet in odoo.

Avatar
Hylkää
Tekijä Paras vastaus

I tried this but doesnt work!

Avatar
Hylkää
Paras vastaus

You could use Javascript for this:

<script>
$( document ).ready(function() {

      if (navigator.geolocation) {
        navigator.geolocation.getCurrentPosition(showPosition);
      } else {
        console.log("Geolocation is not supported by this browser.");
      }
   
    function showPosition(position) {
      console.log("Latitude: " + position.coords.latitude +
      " | Longitude: " + position.coords.longitude);
    }
});
</script>

You would still need additional OWL component to attach these values to your timesheet form:

https://www.odoo.com/documentation/16.0/developer/reference/frontend/owl_components.html

I hope this at least points you into the right direction!

Avatar
Hylkää
Aiheeseen liittyviä artikkeleita Vastaukset Näkymät Toimenpide
3
elok. 25
2613
1
toukok. 25
2646
1
huhtik. 25
3637
1
huhtik. 25
4492
1
huhtik. 25
1962