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
7月 24
|
27575 | ||
|
10
6月 21
|
40210 | ||
|
1
3月 18
|
9376 | ||
|
1
3月 15
|
6231 | ||
|
0
3月 15
|
4035 |
try this: https://learnopenerp.blogspot.com/2020/07/get-web-httprequest-in-odoo.html