Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
1973 Lượt xem

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

Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

I tried this but doesnt work!

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhấ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!

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
3
thg 8 25
2852
1
thg 5 25
2782
1
thg 4 25
3750
1
thg 4 25
4615
1
thg 4 25
2054