Skip to Content
Menu
This question has been flagged
2 Replies
4257 Views

Hi,all:

    I'm trying to create different user in a module,as we know,we usually have "User"and "Manager" in a module,and in security.xml they have code as:
<record id="group_project_user" model="res.groups">
<field name="name">User</field>
<field name="implied_ids" eval="[(4, ref('base.group_user'))]"/>
<field name="category_id" ref="base.module_category_project_management"/>
</record>

<record id="group_project_manager" model="res.groups">
<field name="name">Manager</field>
<field name="category_id" ref="base.module_category_project_management"/>
<field name="implied_ids" eval="[(4, ref('group_project_user'))]"/>
<field name="users" eval="[(4, ref('base.user_root')), (4, ref('base.user_admin'))]"/>
</record>
   But now I'm supposed to add more kinds of users in the module,besides "user" and "manager",the module also needs "Leader" and "Chairman",so what should I do with the code of security.xml?
   Thanks!                                                                                                                                                           

                          

Avatar
Discard
Best Answer

Hi Fabia,

Please look the code,

  
<record id="group_project_user" model="res.groups">
<field name="name">User</field>
<field name="implied_ids" eval="[(4, ref('base.group_user'))]"/>
<field name="category_id" ref="base.module_category_project_management"/>
</record>
<record id="group_project_leader" model="res.groups">
<field name="name">Leader</field>
<field name="category_id" ref="base.module_category_project_management"/>
<field name="implied_ids" eval="[(4, ref('group_project_user'))]"/>
</record>

<record id="group_project_manager" model="res.groups"

<field name="name">Manager</field>
<field name="category_id" ref="base.module_category_project_management"/>
<field name="implied_ids" eval="[(4, ref('group_project_leader'))]"/>
</record>

<record id="group_project_chairman" model="res.groups">
<field name="name">Chairman</field>
<field name="category_id" ref="base.module_category_project_management"/>
<field name="implied_ids" eval="[(4, ref('group_project_manager'))]"/>
<field name="users" eval="[(4, ref('base.user_root')), (4, ref('base.user_admin'))]"/>
</record>


Regards,

Nikhilkrishnan

Avatar
Discard
Author

It seems that in each level I should write code"eval" for previous levels,and write (eval="[(4, ref('base.user_root')), (4, ref('base.user_admin'))]") in last level.

Well,now it works.Thanks. : )

implied_ids are inherited group privileges. A group which inherits other groups, will get all the other groups rights in top of their own

Best Answer

Hello, 

You can check below code maybe its helps you 


<record id="new_crm_groups" model="ir.module.category">
<field name="name">CRM</field>
<field name="sequence">14</field>
</record>
<record id="group_crm_manager" model="res.groups">
<field name="name">CRM Managers</field>
<field name="implied_ids" eval="[(4, ref('base.group_user'))]"/>
<field name="category_id" ref="new_crm_groups"/>
</record>
<record id="group_crm_user" model="res.groups">
<field name="name">CRM Users</field>
<field name="implied_ids" eval="[(4, ref('base.group_user'))]"/>
<field name="category_id" ref="new_crm_groups"/>
</record>
<record id="group_crm_officer" model="res.groups">
<field name="name">CRM Officer</field>
<field name="implied_ids" eval="[(4, ref('base.group_user'))]"/>
<field name="category_id" ref="new_crm_groups"/>
</record>

Thanks


Avatar
Discard