Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
2 Răspunsuri
1856 Vizualizări

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

Imagine profil
Abandonează
Autor Cel mai bun răspuns

I tried this but doesnt work!

Imagine profil
Abandonează
Cel mai bun răspuns

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!

Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
3
aug. 25
2308
1
mai 25
2541
1
apr. 25
3512
1
apr. 25
4343
1
apr. 25
1818