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
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng kýBài viết liên quan | Trả lời | Lượt xem | Hoạt động | |
---|---|---|---|---|
|
1
thg 6 24
|
1531 | ||
|
1
thg 8 25
|
115 | ||
|
4
thg 3 25
|
42067 | ||
|
1
thg 4 23
|
2428 | ||
Reordering Rule Calculus
Đã xử lý
|
|
3
thg 5 24
|
6320 |