تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
2 الردود
1876 أدوات العرض

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!

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
3
أغسطس 25
2352
1
مايو 25
2559
1
أبريل 25
3520
1
أبريل 25
4346
1
أبريل 25
1825