I want to get openerp user client ip address, and in my module add some code copy from web module, as below:
def _get_ipaddress(self, req,httprequest, environ):
wsgienv = req.httprequest.environ
env = dict(
HTTP_HOST=wsgienv['HTTP_HOST'],
REMOTE_ADDR=wsgienv['REMOTE_ADDR'],
)
_logger.log("env:%d", env)
return True
But get Error:AttributeError: 'cursor' object has no attribute 'httprequest'
where params come from : req, httprequest and environ ? Method are called by default with : cr, uid, context where : cr -- database cursor | uid -- current user id | context (dictionary) -- context arguments, like lang, time zone Synthax OLD API = https://doc.odoo.com/v6.0/developer/2_5_Objects_Fields_Methods/methods.html/ But if you start, try to use new api : https://www.odoo.com/documentation/8.0
by using request.environ you may get much more: https://learnopenerp.blogspot.com/2020/07/get-web-httprequest-in-odoo.html