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:
- CRM
- e-Commerce
- Księgowość
- Zapasy
- PoS
- Project
- MRP
To pytanie dostało ostrzeżenie
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 ?
Podoba Ci się ta dyskusja? Dołącz do niej!
Stwórz konto dzisiaj, aby cieszyć się ekskluzywnymi funkcjami i wchodzić w interakcje z naszą wspaniałą społecznością!
Zarejestruj sięPowiązane posty | Odpowiedzi | Widoki | Czynność | |
---|---|---|---|---|
|
7
lip 24
|
27555 | ||
how to get user ip address?
Rozwiązane
|
|
10
cze 21
|
40192 | |
|
1
mar 18
|
9336 | ||
|
1
mar 15
|
6197 | ||
|
0
mar 15
|
4019 |
try this: https://learnopenerp.blogspot.com/2020/07/get-web-httprequest-in-odoo.html