Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
3 Răspunsuri
7335 Vizualizări

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?

Imagine profil
Abandonează

Hello Kahina, did you find a solution?

hello, Did you find the solution?

Cel mai bun răspuns

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


Imagine profil
Abandonează
Cel mai bun răspuns

Hi,

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





Imagine profil
Abandonează

Hi,

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

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

Autor

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)

Cel mai bun răspuns

Hello, yes you can use it by using uid 

Example

('user_id','=',uid)


Imagine profil
Abandonează
Autor

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 Răspunsuri Vizualizări Activitate
1
mai 25
2982
1
mai 24
2513
1
apr. 24
2142
2
feb. 24
3810
3
mai 22
2265