Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
10212 มุมมอง

Hi,
how to get Geo-Location (GPS-Coordinates) in Odoo form where the user post the entry...and save in database.

For Eample
i want to save user location in database where he post any entry .

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Seems like via the controller but how does one consume the endpoints in a model to capture the coordinates? 

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hi,

To get the user location you can use the following code,

country_code_val = request.session['geoip'].get('country_code')
if country_code:
country_id = request.env['res.country'].search([('code', '=', country_code)], limit=1).id
 
 


You can add a new field and can save this to that field, Thanks

อวตาร
ละทิ้ง

What would a "request" be in this context?

Related Posts ตอบกลับ มุมมอง กิจกรรม
Odoo 15 geolocation แก้ไขแล้ว
1
ก.ย. 22
5249
3
มิ.ย. 25
900
Bulk geolocate existing partners แก้ไขแล้ว
1
ธ.ค. 24
4031
0
ธ.ค. 24
877
2
ก.ค. 24
2213