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

Hello Odoo Technical friends,


Dear, I followed a tutorial from : www*cybrosys*com/blog/how-to-add-a-create-button-near-tree-and-kanban-view-in-odoo-16


I want to ask, how do we limit users based on res.groups on the new button that we have created?


The code I made is


< xp at h ex pr =" // *[ @c la ss =' bt n bt n- pr im ar y o_ li st _b ut to n_ ad d' ]" p os it io n= "a ft er "> 

< t t- if =" us er _h as _g ro up (' pr od uc t. gr ou p_ ad mi n' )" >

 

C li ck Me 

< /b ut to n> 

< /t >

xp at h>


However, it turns out I get an error message like this: OwlError: An error occurred in the owl lifecycle (see this Error's "cause" property) Caused by: TypeError: ctx.user_has_group is not a function


Do any of you have a solution?


Thank you.



Update

Thanks, i got solution from ajscripts.com


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

Hi,

Please try the below code:

 <t-if="request.env.user.has_group('product.group_admin')"/>


Hope it helps

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
5
ก.ค. 25
7630
5
มี.ค. 25
2889
1
ก.พ. 25
1422
1
ก.พ. 24
2793
1
ม.ค. 24
14262