콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다

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
8월 25
2843
1
5월 25
2778
1
4월 25
3744
1
4월 25
4612
1
4월 25
2049