Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
3 ตอบกลับ
9332 มุมมอง


Hi all, how can we get the logined user id in qweb template , it is not a report template.

It's the mail.activity_items template. i need to put a condition on 'o_thread_message_tools' based on the logined user id. 

My intention is to get the logined user id in qweb template.

Sample code i tried is,    

<t t-if="activity.create_uid[0] == user.id">

#code

</t> 


อวตาร
ละทิ้ง
ผู้เขียน คำตอบที่ดีที่สุด

These are not working in mail.activity_items template, so i'm trying to pass 'uid' value in mail_activity.js file in this template rendering code. I dont have much points to comment on the answers @Rakesh Vadeghar and @Mitul Shingala. 

Thank you very much  for the support. 

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hello

try with below line

<span t-esc="activity.env.user.id"/>

so your condition is like

<t t-if="activity.create_uid.id == activity.env.user.id">

i hope this will helps you.

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

To get logged in user id  try this 

<p t-field="o.env.user.id"/>
อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
มิ.ย. 18
5966
0
เม.ย. 18
3478
1
มี.ค. 25
958
1
พ.ค. 23
10035
Calling QWeb template in Javascript แก้ไขแล้ว
1
ก.พ. 24
13061