Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
2 Risposte
10192 Visualizzazioni

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 .

Avatar
Abbandona
Risposta migliore

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

Avatar
Abbandona
Risposta migliore

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

Avatar
Abbandona

What would a "request" be in this context?

Post correlati Risposte Visualizzazioni Attività
1
set 22
5238
3
giu 25
886
1
dic 24
4026
0
dic 24
873
2
lug 24
2138