コンテンツへスキップ
メニュー
この質問にフラグが付けられました

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
2610
1
5月 25
2644
1
4月 25
3633
1
4月 25
4491
1
4月 25
1961