コンテンツへスキップ
メニュー
この質問にフラグが付けられました
4 返信
8480 ビュー

Hi,
How can i add a field in user settings form and make a menu item visible based on this field.
Thanks in advance.

アバター
破棄
最善の回答

Hi,

Boolean fields that we see in the users form are the groups in the database, suppose if you need to see a check Box named XYZ in the users form view and if you need to make a menu named ABCD visible only for the users, if the XYZ is ticked, what you have to do is that Create a group named XYZ(either you can do it from ui or from the code), so once the new group is created it will be visible in the users form view.

Now you have to take the menu and add this newly created group to it(either from ui or code).

For creating group from the user interface, you can do it from: Settings -> User & Companies -> Groups(Make sure that the debug mode is activated)

From Code:

<record id="group_xyz" model="res.groups">
<field name="name">XYZ</field>
</record>


To add this group to the menu from UI: Settings -> Technical -> User Interface -> Menu items, search the menu and open it, in the Access rights tab you can see the groups(if there is already some groups, either you can keep it as such or remove it and add the newly created group to it.

From the Code:

<record id="menu_abcd" model="ir.ui.menu">
<field name="groups_id" eval="[(4, ref('group_xyz'))]"/>
</record>


Thanks

アバター
破棄
最善の回答

Hello Peter,

You can do a bit of modification in search method of ir.ui.menu

アバター
破棄
関連投稿 返信 ビュー 活動
5
1月 25
22259
1
3月 19
6406
0
3月 19
3815
0
5月 15
3168
0
1月 24
2790