Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
2 Ответы
1877 Представления

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!

Аватар
Отменить
Related Posts Ответы Просмотры Активность
3
авг. 25
2352
1
мая 25
2559
1
апр. 25
3520
1
апр. 25
4346
1
апр. 25
1825