İçereği Atla
Menü
Bu soru işaretlendi
2 Cevaplar
1878 Görünümler

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

Avatar
Vazgeç
Üretici En İyi Yanıt

I tried this but doesnt work!

Avatar
Vazgeç
En İyi Yanıt

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
Vazgeç
İlgili Gönderiler Cevaplar Görünümler Aktivite
3
Ağu 25
2360
1
May 25
2560
1
Nis 25
3520
1
Nis 25
4346
1
Nis 25
1826