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

Hello,


I would like to know how to get current user (record in res.users) in XML view knowing that I would like to use it in a domain, let's say : ('field',  "=",  current_user.field.id) 

Is it possible to get cureent_user using "uid" or is there any other way to do it?

Ảnh đại diện
Huỷ bỏ

Hello Kahina, did you find a solution?

hello, Did you find the solution?

Câu trả lời hay nhất

You can use [user.id]  or uid in your Xml.


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

Hi,

You can use UID to get the login user in XML ,





Ảnh đại diện
Huỷ bỏ

Hi,

You can use UID to get the login user in XML ,

<field name="user_id" string="Related User" domain="[('id', '=', uid)]"/>

Tác giả

That does not work in a case where I would like to compare a field with the same field value of current user, something like this : ('field', "=", current_user.field.id)

Câu trả lời hay nhất

Hello, yes you can use it by using uid 

Example

('user_id','=',uid)


Ảnh đại diện
Huỷ bỏ
Tác giả

I would like to compare not user_id field but another field of the current user with the same field in the current model, something like this : ('field', "=", current_user.field.id)

Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 5 25
2966
1
thg 5 24
2495
1
thg 4 24
2112
2
thg 2 24
3793
3
thg 5 22
2256