Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
2 Odpowiedzi
10178 Widoki

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 .

Awatar
Odrzuć
Najlepsza odpowiedź

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

Awatar
Odrzuć
Najlepsza odpowiedź

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

Awatar
Odrzuć

What would a "request" be in this context?

Powiązane posty Odpowiedzi Widoki Czynność
1
wrz 22
5231
3
cze 25
858
1
gru 24
4023
0
gru 24
867
2
lip 24
2083