跳至内容
菜单
此问题已终结
3 回复
7116 查看

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
5月 25
2855
1
5月 24
2323
1
4月 24
1968
2
2月 24
3623
3
5月 22
2130