跳至内容
菜单
此问题已终结

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
2451
1
5月 25
2578
1
4月 25
3540
1
4月 25
4386
1
4月 25
1850