콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
9 답글
14720 화면

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

관련 게시물 답글 화면 활동
1
6월 24
1585
1
8월 25
330
4
3월 25
42339
1
4월 23
2544
3
5월 24
6409