1

I'm trying to get the logged in user's id from self._uid. But when I logged in with a user and I got the user_id = 1 (which is the user_id of the administrator account)

That is my line. Am I doing something wrong?

user_id = self._uid

Jeremy Gillbert
  • 133
  • 2
  • 10

1 Answers1

1

Replace your code

from

user_id = self._uid

to

user_id = self.env.user

These will give us current logged user as a recordset. So if you need id, get it like self.env.user.id

Bhavesh Odedra
  • 10,990
  • 12
  • 33
  • 58