Odoo Help

0

Where does « request.uid » take his value?

By
Pascal Tremblay
on 8/12/15, 8:19 AM 1,102 views

Hello guys,

In a custom module, I have this piece of code :

        def get_pricelist():

                cr, uid, context, pool = request.cr, request.uid, request.context, request.registry

                _logger.error("uid :: %s", str(uid))

The logger returns the value of the current user. Good.

But where does  « request.uid » take his value? I can't find the python code for this...

Thanks to help

2

Hello Pascal,

You can see the request.uid is taking vaule inside the file : /openerp/addons/base/ir/ir_http.py.

There is one method named : _auth_method_public 

    def _auth_method_public(self):
if not request.session.uid:
dummy, request.uid = self.pool['ir.model.data'].get_object_reference(request.cr, openerp.SUPERUSER_ID, 'base', 'public_user')
else:
request.uid = request.session.uid

Also, Inside website module this method is inherited to manage request.uid according to website configuration.

I am sure this will guide you in right direction.

Thanks. 

thanks a lot. I try it and I come back.

Pascal Tremblay
on 8/12/15, 9:04 AM

yes, let me know if it worked or not !

Emipro Technologies Pvt. Ltd.
on 8/12/15, 9:07 AM

About This Community

This platform 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.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 8/12/15, 8:19 AM
Seen: 1102 times
Last updated: 8/13/15, 4:51 AM