Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

1

Exception: Object Unbound in request

By
aneesh ATEES Infomedia Pvt Ltd
on 11/21/16, 4:27 AM 155 views

from openerp.http import request

try:
    ipnew = request.httprequest.environ['REMOTE_ADDR']

except Exception as e:
    print " Exception on request ",e

    pass

1

aneesh ATEES Infomedia Pvt Ltd

--aneesh ATEES Infomedia Pvt Ltd--
765
| 5 1 6
Thrissur, India
--aneesh ATEES Infomedia Pvt Ltd--

9995074692

aneesh ATEES Infomedia Pvt Ltd
On 11/23/16, 7:48 AM

issue solved environ = request.httprequest.headers.environ

print environ.get("REMOTE_ADDR") need to put inside the function instead of class header

0
shameem@aχoncoms
On 11/21/16, 4:36 AM

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

aneesh ATEES Infomedia Pvt Ltd
on 11/21/16, 4:43 AM

I tested this inside a compute function

it is working

shameem@aχoncoms
on 11/21/16, 4:53 AM

can you provide that sample code

aneesh ATEES Infomedia Pvt Ltd
on 11/21/16, 5:05 AM

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")

shameem@aχoncoms
on 11/21/16, 6:06 AM

don't look first line of function

shameem@aχoncoms
on 11/21/16, 6:08 AM

still i get excception of object unbound

aneesh ATEES Infomedia Pvt Ltd
on 11/22/16, 1:05 PM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 11/21/16, 4:27 AM
Seen: 155 times
Last updated: 11/24/16, 1:07 AM