تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
7873 أدوات العرض

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

الصورة الرمزية
إهمال
أفضل إجابة

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.

yes, let me know if it worked or not !

المنشورات ذات الصلة الردود أدوات العرض النشاط
1
أكتوبر 21
3123
1
مارس 15
3806
0
يناير 24
1780
0
أكتوبر 20
3126
3
يوليو 25
7016