Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
3 Відповіді
7343 Переглядів

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
2994
1
трав. 24
2529
1
квіт. 24
2149
2
лют. 24
3811
3
трав. 22
2268