Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
24228 Lượt xem

How to get the current user id in an Odoo Web Controller ?

Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

Hi Yenthe,

In Odoo 8, inside a web controller it doesn't work for me and I'm using that codes instead :

request.uid

or

request.session.uid

Regards,
Slim

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi Slim,

You can get the user his id out of the environment its context like this:

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

Regards,
Yenthe

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
3
thg 5 25
2396
0
thg 12 23
2248
1
thg 7 23
2227
0
thg 7 22
1816
3
thg 9 21
21566