تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
3 الردود
7353 أدوات العرض

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)

المنشورات ذات الصلة الردود أدوات العرض النشاط
1
مايو 25
3000
1
مايو 24
2536
1
أبريل 24
2152
2
فبراير 24
3823
3
مايو 22
2271