콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다

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
22332
1
3월 19
6497
0
3월 19
3884
0
5월 15
3214
0
1월 24
2844