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.

0

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

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

Hi, 

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.

0

Maniganda

--Maniganda--
1038
| 5 7 7
Bangalore, India
--Maniganda--
Maniganda
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.

Ivan
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.

Ivan
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 community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

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