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

How to get the location address of the user? 

อวตาร
ละทิ้ง

Uh this is very little info. By the IP for example?

คำตอบที่ดีที่สุด

If you are looking with ip, then give free request to ipinfo.io

eg:

import re
import json
from urllib2 import url
openurl = 'http://ipinfo.io/json'
response = urlopen(url)
data = json.load(response)
# Here data will contain all info related with the requested ip,
###########
# output
{u'loc': u'10.0333,76.3000', u'city': u'Edapally', u'ip': 
u'137.97.91.82', u'region': u'Kerala', u'country': u'IN', u'org': 
u'AS55836 Reliance Jio Infocomm Limited', u'postal': u'682024'}

This kind of requests each time when login employee helps?? or try google map geolocation API or places API

Thanks.


อวตาร
ละทิ้ง
ผู้เขียน

Thanks Hilar.

Welcome :)

On Fri, Mar 16, 2018 at 6:28 AM, Giezel Esteves <giezelesteves23@gmail.com> wrote:

Thanks Hilar.

--
Giezel Esteves


Sent by Odoo S.A. using Odoo.




--
Hilar AK  Python / Odoo Developer

m: +917736617619
e: hilarak@gmail.com
Follow me:
twitteryoutubegithubstack-overflow


คำตอบที่ดีที่สุด

  user_id =   fields.Many2one('res.users', string='Users')

  address_from = fields.Char(string='Adress', index=True)

  @api.onchange('user_id')

def _onchange_user_id(self):

self. address_from  = self.user_id.address

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
ส.ค. 17
4940
2
เม.ย. 20
3887
Do Timesheets work in CE v10? แก้ไขแล้ว
1
ส.ค. 17
3808
Paypal redirection แก้ไขแล้ว
2
เม.ย. 17
3550
2
ก.ค. 24
2050