Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
3 Risposte
6361 Visualizzazioni

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?

Avatar
Abbandona

Hello Kahina, did you find a solution?

hello, Did you find the solution?

Risposta migliore

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


Avatar
Abbandona
Risposta migliore

Hi,

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





Avatar
Abbandona

Hi,

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

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

Autore

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)

Risposta migliore

Hello, yes you can use it by using uid 

Example

('user_id','=',uid)


Avatar
Abbandona
Autore

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)

Post correlati Risposte Visualizzazioni Attività
1
mag 24
1705
1
apr 24
1391
1
nov 22
2217
2
feb 24
3232
3
mag 22
1882