Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
4 Trả lời
8502 Lượt xem

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

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hello Peter,

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

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
5
thg 1 25
22266
1
thg 3 19
6441
0
thg 3 19
3849
0
thg 5 15
3171
0
thg 1 24
2805