Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
3 Răspunsuri
6518 Vizualizări

Hi,

I create a new module that work well with admin user. When I create a new user the menuitem for my new user dissapear. Why?

My file ir.model.access.csv:

id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_calculator_price,access_calculator_price,model_calculator_price,group_calculator_price,1,1,1,1

My file xx_security.xml:

<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="0">

    <record model="ir.module.category" id="model_calculator_price">
        <field name="name">Folha de Cálculo</field>
        <field name="description">Something...</field>
        <field name="sequence">20</field>
    </record>

    <record model="res.groups" id="group_calculator_price">
        <field name="name">Manager</field>
        <field name="comment">Acesso Folha de Cálculo</field>
        <field name="category_id" ref="model_calculator_price"/>
    </record>


</data>

</openerp>

My file xml with view:

...
<menuitem id="menu_bionutrigal_calc" name="Test" groups="base.group_user"/>

<menuitem id="menu_bionutrigal_calc2" name="Calculator" parent="menu_bionutrigal_calc" groups="base.group_user" ></menuitem>

<menuitem action="action_calculator_price" string="Calculator Data" id="menu_bionutrigal_calc3" parent="menu_bionutrigal_calc2" groups="base.group_user"></menuitem>
....

My new user don't see the menu with name Test. With admin user is possible add the permission for my new user:

image description

But when the menuitem dissapear when I enter in openerp with this user.

(I've tested the first two answers, and nothing happened... So I add the text below)

Probably I've some error in the xx_security.xml file or in __openerp__.py.... Because when I run the openerp I always have this warning:

  WARNING testes_infinite openerp.modules.loading: The model calculator.price has no access rules, consider adding one. E.g. access_calculator_price,access_calculator_price,model_calculator_price,,1,1,1,1

My __openerp__.py :

....
    'init_xml': ['security/xx_security.xml',
                 'security/ir.model.access.csv'],
    'update_xml': ['vi_infinitechoice_sequence.xml',
                    ],
    'data': ['security/vi_infinitechoice_security.xml','security/ir.model.access.csv'],
.....

Anyone helps me please?

Imagine profil
Abandonează
Autor Cel mai bun răspuns

I don't know what the problem was, but the version that is working is this: xx_security.xml:

<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data noupdate="0">
        <record model="ir.module.category" id="module_category_group_calc_user">
            <field name="name">Calculation data</field>
            <field name="description">Something...</field>
            <field name="sequence">20</field>
        </record>
        <record model="res.groups" id="group_calc_user">
            <field name="name">User</field>
            <field name="comment">Access to calculation sheet.</field>
            <field name="category_id" ref="module_category_group_calc_user"/>
        </record>
    </data>

ir.model.access.csv

id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
acess_infinitechoices_calc,calculator.price,model_calculator_price,group_calc_user,1,1,1,1

in view:

<menuitem id="menu_bionutrigal_calc" name="Bionutrigal" />

<!-- Menu Secundario - Menu Secundário-->
<menuitem id="menu_bionutrigal_calc2" name="Calculator" parent="menu_bionutrigal_calc" ></menuitem>

<!-- SubMenu com uma action que indica o que faz ao clicar no "Calculator Data" -->
<menuitem action="action_calculator_price" string="Calculator Data" id="menu_bionutrigal_calc3" parent="menu_bionutrigal_calc2" ></menuitem>

Thanks for the answers, know it's fixed. Don't know if it is the best solution. I have some problem with security in openerp =S

Imagine profil
Abandonează
Cel mai bun răspuns

Hi,

Better you remove the group in menu. Then it will be available to all users.

Imagine profil
Abandonează
Cel mai bun răspuns

Go to Settings>Technical>Menu Items and look for your menu, then check if Human Resources / Employee is on Group Table, or you can assign other user.

Imagine profil
Abandonează

This is because you have assigned the group "base.group_user" to your menu, this is the XML ID for the group "Human Resources / Employee". If you want to use the group permissions in your security file, change "base.group_user" to "MODULE_NAME.group_calculator_price"

Related Posts Răspunsuri Vizualizări Activitate
1
feb. 25
7840
1
oct. 24
69136
2
dec. 23
25645
1
oct. 21
9518
1
mar. 15
6659