Am trying to track the visitor ip address ,but am failed to implement it..please help me...Urgent.
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- إدارة علاقات العملاء
- e-Commerce
- المحاسبة
- المخزون
- PoS
- Project
- MRP
لقد تم الإبلاغ عن هذا السؤال
Hi,
You can try the below code:
if "HTTP_X_FORWARDED_FOR" in request.httprequest.environ:
# Virtual host
ip = request.httprequest.environ["HTTP_X_FORWARDED_FOR"]
elif "HTTP_HOST" in request.httprequest.environ:
# Non-virtualhost
ip = request.httprequest.environ["REMOTE_ADDR"]
Hope this could helps
I got Exception 'object unbound'
Can you paste your code ..
from openerp.http import request
def git_ip():
ipnew = request.httprequest.headers.environ['REMOTE_ADDR']
return ipnew
from openerp.http import request
ipnew = request.httprequest.headers.environ['REMOTE_ADDR']
return ipnew
from openerp.http import request
def get_ip():
ipnew = request.httprequest.environ['REMOTE_ADDR']
return ipnew
May be you're missing @http.rout decorator. Btw from where you're calling your method ?
هل أعجبك النقاش؟ لا تكن مستمعاً فقط. شاركنا!
أنشئ حساباً اليوم لتستمتع بالخصائص الحصرية، وتفاعل مع مجتمعنا الرائع!
تسجيلالمنشورات ذات الصلة | الردود | أدوات العرض | النشاط | |
---|---|---|---|---|
|
7
يوليو 24
|
27623 | ||
how to get user ip address?
تم الحل
|
|
10
يونيو 21
|
40255 | |
|
1
مارس 18
|
9397 | ||
|
1
مارس 15
|
6257 | ||
|
0
مارس 15
|
4044 |
try this: https://learnopenerp.blogspot.com/2020/07/get-web-httprequest-in-odoo.html