تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
2 الردود
10319 أدوات العرض

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?

المنشورات ذات الصلة الردود أدوات العرض النشاط
Odoo 15 geolocation تم الحل
1
سبتمبر 22
5373
3
يونيو 25
1147
1
ديسمبر 24
4204
0
ديسمبر 24
1029
2
يوليو 24
2482