Odoo Help

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 704 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--
1043
| 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

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: 9/23/14, 9:12 PM
Seen: 704 times
Last updated: 3/16/15, 8:10 AM