Odoo Help


How can i search or get the field "id" from table "res_users" of the one that is currently logged in

Lakay lakay
on 9/23/14, 9:12 PM 642 views


How can i search or get the field "id" from table "res.users" of the one that is currently logged in.

i tried this one.    my_id=self.pool.get('res.users').search(cr,uid,['id','=','id']), but it returns all records id ( i want the id only of the account im using currently)

because i want to use this "my_id" as a indicator where i will write my data in future.



| 5 7 7
Bangalore, India
On 9/24/14, 12:24 AM

Hi Lakay, you can use "uid" parameter in functions to get the current user logged in or you can get it by the context

if by the context, how will i do it?

Lakay lakay
on 9/24/14, 1:30 AM

Lakay, change your code to: my_id=self.pool.get('res.users').search(cr,uid,['id','=',uid]), That should do it.

on 9/24/14, 7:17 AM

Actually, as Maniganda said, you can use uid directly without having to do a search. Sorry, my previous answer is a unnecessary.

on 9/24/14, 7:18 AM

thanks now i get it.

Lakay lakay
on 9/24/14, 11:04 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 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.


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)


Asked: 9/23/14, 9:12 PM
Seen: 642 times
Last updated: 3/16/15, 8:10 AM