Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
3 ตอบกลับ
7321 มุมมอง

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?

อวตาร
ละทิ้ง

Hello Kahina, did you find a solution?

hello, Did you find the solution?

คำตอบที่ดีที่สุด

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


อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hi,

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





อวตาร
ละทิ้ง

Hi,

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

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

ผู้เขียน

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)

คำตอบที่ดีที่สุด

Hello, yes you can use it by using uid 

Example

('user_id','=',uid)


อวตาร
ละทิ้ง
ผู้เขียน

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)

Related Posts ตอบกลับ มุมมอง กิจกรรม
1
พ.ค. 25
2972
1
พ.ค. 24
2504
1
เม.ย. 24
2129
2
ก.พ. 24
3803
3
พ.ค. 22
2260