Search code examples
python-3.xpython-requestsodoo-12

ODOO12: How retrieve the id of logged-in user?


I want to retrieve the id of logged-in user in Odoo 12 but I have many errors. This my code:

user_id = http.request.env.context.get('uid')


Solution

  • Try the following code:

    user_id = http.request.env.user.id