Odoo - 如何建立互斥的用户组

时间:2023-01-31 20:24:16

When you go to configuration->users in odoo as administrator, you see two groups under the category administration: Settings and Access rights. Since one of these groups are selected from a combo box, it seems to me like these groups are mutually exclusive, that is that a user can't be a member of both groups.

当您以管理员身份访问odoo中的configuration-> users时,您会在类别管理下看到两个组:设置和访问权限。由于这些组中的一个是从组合框中选择的,因此在我看来这些组是互斥的,即用户不能是两个组的成员。

I need to do exactly the same with two groups under a custom category which I have created with the following data file:

我需要使用以下数据文件创建的自定义类别下的两个组完全相同:

<record id="FVO" model="ir.module.category">
    <field name="name"> FVO </field>
</record>
<record id="FVO_nuova" model="res.groups">
    <field name="name">FVO - nuova vista</field>
    <field name="category_id" ref="FVO"/>
</record>
<record id="FVO_vecchia" model="res.groups">
    <field name="name">FVO - vecchia vista</field>
    <field name="category_id" ref="FVO"/>
</record>

But in the users form, they appear as two check boxes, which means that the user could be member of both groups.

但在用户表单中,它们显示为两个复选框,这意味着用户可以是两个组的成员。

Now I've studied both of these groups, and it's category, inspecting also the tables in which they are stored, to try to find out which flag they have so that Settings and Access rights can't be applied to one user at the same time, but for the life of me, I can't find anything special nor in the record for the group, nor in the record for the category.

现在我已经研究了这两个组,它的类别,检查它们存储的表,以试图找出它们具有哪个标志,以便设置和访问权限不能同时应用于一个用户时间,但对于我的生活,我找不到任何特殊的东西,也没有找到该组的记录,也没有找到该类别的记录。

Is someone able to point out what I'm missing?

有人能指出我错过了什么吗?

1 个解决方案

#1


0  

I don't know the meaning of vecchia vista and nuova vista so i cannot understand if they are cascade or not, if they are cascade (inherited) rights (like 'see_own_leads' and 'see_all_leads'), you should use <field name="implied_ids" eval="[(4, ref('FVO_nuova'))]"/> in your FVO_vecchia group so odoo will understand the user should select one of your groups not both of them.

我不知道vecchia vista和nuova vista的含义所以我无法理解它们是否是级联的,如果它们是级联(继承)权限(如'see_own_leads'和'see_all_leads'),你应该使用 因此odoo将理解用户应选择您的一个组而不是两个组。

If your groups are not meant to be cascade, i should define 3 groups like this:

如果您的组不是级联,我应该定义3个这样的组:

`

`

<record id="FVO_none" model="res.groups">
    <field name="name">FVO - no access</field>
    <field name="category_id" ref="FVO"/>
</record> 
<record id="FVO_nuova" model="res.groups">
    <field name="name">FVO - nuova vista</field>
    <field name="implied_ids" eval="[(4, ref('FVO_none'))]"/>
    <field name="category_id" ref="FVO"/>
</record>
<record id="FVO_vecchia" model="res.groups">
    <field name="name">FVO - vecchia vista</field>
    <field name="implied_ids" eval="[(4, ref('FVO_none'))]"/>
    <field name="category_id" ref="FVO"/>
</record>

`

`

#1


0  

I don't know the meaning of vecchia vista and nuova vista so i cannot understand if they are cascade or not, if they are cascade (inherited) rights (like 'see_own_leads' and 'see_all_leads'), you should use <field name="implied_ids" eval="[(4, ref('FVO_nuova'))]"/> in your FVO_vecchia group so odoo will understand the user should select one of your groups not both of them.

我不知道vecchia vista和nuova vista的含义所以我无法理解它们是否是级联的,如果它们是级联(继承)权限(如'see_own_leads'和'see_all_leads'),你应该使用 因此odoo将理解用户应选择您的一个组而不是两个组。

If your groups are not meant to be cascade, i should define 3 groups like this:

如果您的组不是级联,我应该定义3个这样的组:

`

`

<record id="FVO_none" model="res.groups">
    <field name="name">FVO - no access</field>
    <field name="category_id" ref="FVO"/>
</record> 
<record id="FVO_nuova" model="res.groups">
    <field name="name">FVO - nuova vista</field>
    <field name="implied_ids" eval="[(4, ref('FVO_none'))]"/>
    <field name="category_id" ref="FVO"/>
</record>
<record id="FVO_vecchia" model="res.groups">
    <field name="name">FVO - vecchia vista</field>
    <field name="implied_ids" eval="[(4, ref('FVO_none'))]"/>
    <field name="category_id" ref="FVO"/>
</record>

`

`