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

I need to add a new group in the Sales category. I have seen that in the "sales_team" module the groups are like this:


<record id="base.module_category_sales_sales" model="ir.module.category">
<field name="description">Helps you handle your quotations, sale orders and invoicing.</field>
<field name="sequence">1</field>
</record>

<record id="group_sale_salesman" model="res.groups">
<field name="name">User: Own Documents Only</field>
<field name="category_id" ref="base.module_category_sales_sales"/>
<field name="implied_ids" eval="[(4, ref('base.group_user'))]"/>
<field name="comment">the user will have access to his own data in the sales application.</field>
</record>

<record id="group_sale_salesman_all_leads" model="res.groups">
<field name="name">User: All Documents</field>
<field name="category_id" ref="base.module_category_sales_sales"/>
<field name="implied_ids" eval="[(4, ref('group_sale_salesman'))]"/>
<field name="comment">the user will have access to all records of everyone in the sales application.</field>
</record>

<record id="group_sale_manager" model="res.groups">
<field name="name">Administrator</field>
    <field name="comment">the user will have an access to the sales configuration as well as statistic reports.</field>
<field name="category_id" ref="base.module_category_sales_sales"/>
<field name="implied_ids" eval="[(4, ref('group_sale_salesman_all_leads')),
                (4, ref('mail.group_mail_template_editor'))]"/>
<field name="users" eval="[(4, ref('base.user_root')), (4, ref('base.user_admin'))]"/>
</record>


So in my custom module I've tried adding the group to the Sales category like this:


<record id="user_channel" model="res.groups">
        <field name="name">User without channel</field>
        <field name="category_id" ref="base.module_category_sales_sales"/>
        <field name="implied_ids" eval="[(4, ref('sales_team.group_sale_salesman'))]"/>
        <field name="comment">User unable to view sales records with channel</field>
</record>


I see that my group is added to the category, but now the fields are no longer selectable, they are now all checkboxes. Is there a way I can add a group without losing the selection type so that I can only choose one group? 

Avatar
Discard
Best Answer

Generally speaking, groups show up as a drop down, when the implied group(s) (-> implied_ids) allow for a hierarchical structure.

As you can see in the example from sales_team, each new group implies its 'predecessor' - or, in other words, group_sale_salesman (User: Own Documents Only) is the lowest access rule possible. The next higher one, group_sale_salesman_all_leads (User: All Documents) essentially means 'everything group_sale_salesman can do/see + x'; Lastly, being a group_sale_manager (Administrator) allows for 'everything group_sale_salesman_all_leads can do/see (and therefore everything group_sale_salesman can do/see) + y'. Or, more visual:

group_sale_salesman
group_sale_salesman_all_leads
group_sale_manager


That being said, in your case you have user_channel (User without channel) imply permission of group_sale_salesman - which means it has the same implications as group_sale_salesman_all_leads which makes it unspecific (in a hierarchical sense), because there is no clear 'place' or 'position' for user_channel. Visually structured, your addition means

group_sale_salesman
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
user_channel
group_sale_salesman_all_leads
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
group_sale_manager

Depending on what you want to achieve, you will have to bring the group into a structure such as

Case A:

Sales:
group_sale_salesman
user_channel
group_sale_salesman_all_leads
group_sale_manager

or

Case B:

Sales:
group_sale_salesman
group_sale_salesman_all_leads
user_channel
group_sale_manager

or

Case C:

Sales:
group_sale_salesman
group_sale_salesman_all_leads
group_sale_manager
Extra Rights:
user_channel


This means, you will have to 

  • override the implied_ids either for group_sale_salesman_all_leads so it implies user_channel (Case A), or 
  • override the implied_ids either for group_sale_manager​ so it implies user_channel (Case B), or 
  • separate user_channel from the Sales Team groups completely and use it as a separate permission to enable per user (Case C)

Case C could still mean that group_sale_salesman_all_leads (for Case A) or group_sale_manager (for Case B) additionally implies user_channel.

Avatar
Discard
Author Best Answer

It was perfectly understood, I was able to solve it now, thank you very much!

Avatar
Discard
Related Posts Replies Views Activity
3
Mar 25
1021
0
Jan 23
809
1
Jun 21
2409
0
Feb 24
793
0
May 20
1139