Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
10197 Lượt xem

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 .

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ

What would a "request" be in this context?

Bài viết liên quan Trả lời Lượt xem Hoạt động
Odoo 15 geolocation Đã xử lý
1
thg 9 22
5241
3
thg 6 25
893
1
thg 12 24
4027
0
thg 12 24
874
2
thg 7 24
2162