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

Hi guys, I'm trying to restrict (invisible make) certain menu items for a specific user group only. I tried using this code:

<record id="account.menu_finance_entries" model="ir.ui.menu"> <field name="groups_id" eval="[(3, ref('base_accounting_kit.group_account_cashier'))]"/> </record>

...but it's not working. I'm still trying to figure out why. If anyone knows a reliable way to do this, please share. Thanks!

形象
丢弃
最佳答案

Hi,


Go to Settings > Technical > Menu Item.

Add the user group in the lines as follows,



Or try the code ,


<record id="account.menu_finance_entries" model="ir.ui.menu">

    <field name="groups_id" eval="[Command.link(ref('base_accounting_kit.group_account_cashier'))]"/>

</record>


Related module;- https://apps.odoo.com/apps/modules/19.0/hide_menu_user


Hope it helps

形象
丢弃
编写者 最佳答案

Thanks a lot for your reply 🙏. I just have a small doubt — if I use 6, [...] as you suggested, will that also affect other user groups and hide the menu for them as well?

形象
丢弃
最佳答案

Hello Uday,

<field name="groups_id" eval="[(3, ref('base_accounting_kit.group_account_cashier'))]"/>


In your case, the menu has no groups assigned, so 3, has no effect.

The 3,  works only if the menu already has assigned groups.(it removes the specified group.)

In your case you want to restrict the menu  to a specific group, so you need to overwrite all existing groups using 6, 


<record id="account.menu_finance_entries" model="ir.ui.menu">

    <field name="groups_id" eval="[(6, [ref('base_accounting_kit.group_account_cashier')])]"/></record>

I hope this is helpful for you..

形象
丢弃

Hello Uday,
You want to hide the menu for others except this user group "group_account_cashier", right?

相关帖文 回复 查看 活动
0
9月 25
4
2
9月 25
133
1
9月 25
176
5
9月 25
1118
1
9月 25
358