Zum Inhalt springen
Menü
Sie müssen registriert sein, um mit der Community zu interagieren.
Diese Frage wurde gekennzeichnet

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

Avatar
Verwerfen
Autor Beste Antwort

I tried this but doesnt work!

Avatar
Verwerfen
Beste Antwort

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
Verwerfen
Verknüpfte Beiträge Antworten Ansichten Aktivität
3
Aug. 25
2458
1
Mai 25
2578
1
Apr. 25
3541
1
Apr. 25
4389
1
Apr. 25
1851