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

I am creating a custom module in Odoo for a faculty and y need to create 3 roles (groups): students, professors and admins. An user cannot have 2 roles at the same time, so it could only be either a teacher, a professor or an admin. I have defined the permisions in the following code. But for selecting those permissions, Odoo creates a view with checkboxes, where you can chose 2 or more roles at the same time, instead of a selection field (dropdown), I dont want that. How can I force Odoo to create a dropdown for the selection of those roles, so I can only select one


<record model="ir.module.category" id="module_category_faculty">
    <field name="name">Faculty</field>
    <field name="description">Faculty Roles</field>
    <field name="sequence">45</field>
</record>

<record id="group_faculty_student" model="res.groups">
    <field name="name">Student</field>
    <field name="category_id" ref="module_category_faculty"/>
</record>

<record id="group_faculty_professor" model="res.groups">
    <field name="name">Professor</field>
    <field name="category_id" ref="module_category_faculty"/>
</record>

<record id="group_faculty_admin" model="res.groups">
    <field name="name">Admin</field>
    <field name="category_id" ref="module_category_faculty"/>
</record>
아바타
취소
베스트 답변

Hi Ernesto Ruiz,

<record model="ir.module.category" id="college_management">

        <field name="name">College Management</field>

    </record>

    <record id="group_student" model="res.groups">

        <field name="name">Student</field>

        <field name="category_id" ref="college_management"/>

        <field name="implied_ids" eval="[(4, ref('base.group_user'))]"/>

    </record>

    <record id="group_professor" model="res.groups">

        <field name="name">Professor</field>

        <field name="category_id" ref="college_management"/>

        <field name="implied_ids" eval="[(4, ref('base.group_user')),(4, ref('group_student'))]"/>

    </record>

    <record id="group_admin" model="res.groups">

        <field name="name">Admin</field>

        <field name="category_id" ref="college_management"/>

        <field name="implied_ids" eval="[(4, ref('base.group_user')),(4, ref('group_student'))]"/>

    </record>

Thank You!

Regards,




Email:      odoo@aktivsoftware.com  

Skype: kalpeshmaheshwari

   

아바타
취소

Thanks this solution help me !

Hello !
I don't think your solution would work. In order to have a droplist, you have to have a hiearchy in the implied_ids. If group_professor and group_admin both have the same implied_ids, it'll still show as checkboxes.

The correct way would be:
<record model="ir.module.category" id="college_management">
<field name="name">College Management</field>
</record>
<record id="group_student" model="res.groups">
<field name="name">Student</field>
<field name="category_id" ref="college_management"/>
<field name="implied_ids" eval="[(4, ref('base.group_user'))]"/>
</record>
<record id="group_professor" model="res.groups">
<field name="name">Professor</field>
<field name="category_id" ref="college_management"/>
<field name="implied_ids" eval="[(4, ref('group_student'))]"/>
</record>
<record id="group_admin" model="res.groups">
<field name="name">Admin</field>
<field name="category_id" ref="college_management"/>
<field name="implied_ids" eval="[(4, ref('group_professor'))]"/>
</record>

관련 게시물 답글 화면 활동
1
10월 24
1020
0
6월 24
893
0
11월 23
1335
1
11월 23
3252
1
6월 23
1939