from openerp.http import request
try:
ipnew = request.httprequest.environ['REMOTE_ADDR']
except Exception as e:
print " Exception on request ",e
pass
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
from openerp.http import request
try:
ipnew = request.httprequest.environ['REMOTE_ADDR']
except Exception as e:
print " Exception on request ",e
pass
issue solved environ = request.httprequest.headers.environ
print environ.get("REMOTE_ADDR") need to put inside the function instead of class header
Actually I don't know more aboute REMOTE_ADDR
But this is possible
from openerp.http import request
environ = request.httprequest.headers.environ
print environ.get("REMOTE_ADDR")
My output
127.0.0.1
May help you
I am still getting Exception object Unbound
I tested this inside a compute function
it is working
can you provide that sample code
class Foo(models.Model):
____@api.one
____def _compute_progress(self):
________self.progress = lib.progress_by_state(self)
________from openerp.http import request
________environ = request.httprequest.headers.environ
________print environ.get("REMOTE_ADDR")
don't look first line of function
still i get excception of object unbound
Create an account today to enjoy exclusive features and engage with our awesome community!
РеєстраціяRelated Posts | Відповіді | Переглядів | Дія | |
---|---|---|---|---|
|
1
черв. 24
|
1265 | ||
|
4
бер. 25
|
40952 | ||
|
1
квіт. 23
|
2135 | ||
Reordering Rule Calculus
Вирішено
|
|
3
трав. 24
|
6011 | |
API Problem in data return
Вирішено
|
|
2
черв. 22
|
2687 |