Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
1864 มุมมอง

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

อวตาร
ละทิ้ง
ผู้เขียน คำตอบที่ดีที่สุด

I tried this but doesnt work!

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

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!

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
3
ส.ค. 25
2321
1
พ.ค. 25
2545
1
เม.ย. 25
3515
1
เม.ย. 25
4344
1
เม.ย. 25
1820