用户角色的OpenERP 7访问权限 [英] OpenERP 7 Access Rights for User Roles

查看:73
本文介绍了用户角色的OpenERP 7访问权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要为我的模块添加用户并且需要一些菜单项限制.主要是我创建了用户和管理员角色.在设置->用户->创建用户->访问权限中,我更改了用户或管理员.但没有影响为该用户显示,但不显示任何菜单项.也不会显示主菜单项. 我在bpl_security.xml中添加了代码,并将该xml文件映射到openerp.py文件中. 我缺少什么吗?请检查我的代码和建议

I need to add users for my module and need some menuitem restriction for them.mainly i created user and manager roles.in Settings -> Users -> create user -> Access Rights and i change User or Manager.but no affect for that user and not shows any menu items to them.main menu item also not shows. I added code in bpl_security.xml and that xml file mapped in openerp.py file. is anything missing to me.?please check my code and advice

<?xml version="1.0" ?>
<openerp>
    <data>
        <record model="ir.module.category" id="module_checkroll_category">
            <field name="name">Checkroll</field>
            <field name="description">manager-create new products</field>
            <field name="sequence">16</field>
        </record>
        <record id="group_checkroll_user" model="res.groups">
            <field name="name">Checkroll_User</field>
            <field name="category_id" ref="module_checkroll_category" />
        </record>
        <record id="group_checkroll_manager" model="res.groups">
            <field name="name">Checkroll_Manager</field>
            <field name="implied_ids" eval="[(4, ref('group_checkroll_user'))]" />
            <field name="category_id" ref="module_checkroll_category" />
            <field name="users" eval="[(4, ref('base.user_root'))]" />
        </record>
    </data>
</openerp>

我的整个代码上传此处&参见其"bpl_view.xml行705"

my whole code uploaded here & see its' bpl_view.xml line no 705

这里显示了我在view.xml中的相关部分

here shows my related part in view.xml

<menuitem id="menu_bpl" name="Checkroll/Registration" groups="group_checkroll_manager,group_checkroll_user" />
<menuitem id="menu_bpl_ref" name="Reference" parent="menu_bpl"
groups="group_checkroll_user" />
<menuitem id="menu_bpl_logic" name="Company Specific" parent="menu_bpl"
groups="group_checkroll_manager" />

推荐答案

在您的模块中找不到任何 ir.model.access.csv .您必须在模块中创建ir.model.access.csv,建议您创建一个安全文件夹并将安全相关文件放在其中

I not found any ir.model.access.csv for access rights in your module. You have to create ir.model.access.csv in your module, I suggest you to create a security folder and put security related file there

Security
  ----ir.model.access.csv
  ----sale_security.xml

并更改 openerp .py文件(如

and change in openerp.py file like

"security/sale_security.xml", "security/ir.model.access.csv",

'security/sale_security.xml', 'security/ir.model.access.csv',

在ir.model.access.csv文件中提供如下访问权限:

And in the ir.model.access.csv file provide access rights like this:

id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_sale_shop,sale.shop,model_sale_shop,base.group_user,1,0,0,0
access_sale_order,sale.order,model_sale_order,base.group_sale_salesman,1,1,1,0

access_sale_shop是您访问权限的ID,它将是您可以这样写的任何东西,例如,access_sale_shop1,access_sale_shop2等.

access_sale_shop is the id for the your access it will be anythin you can write this like a,access_sale_shop1, access_sale_shop2 etc..

name是对象的名称,sale.shop是对象的名称

name is in name of object , sale.shop is the name of your object

perm_read,perm_write,perm_create,perm_unlink用于读取,写入,创建,取消链接它给您1表示该组具有权限,0表示不具有权限,例如如果您输入perm_create表示用户可以在此对象中创建,希望这样为您清除

perm_read,perm_write,perm_create,perm_unlink are for read, write, create , unlink it you give 1 means this group have rights , 0 means not rights, like if you give in perm_create meand user can create in thi object, hope this clear for you

model_id是模型的ID,在这里model_sale_shop在您的模块中的对象上添加模型,就像:对于该对象 bpl.deduction.estate.data ,它将是 model_bpl_deduction_estate_data

model_id is the id of your model here model_sale_shop add model at your object in you module it will be like : for this object bpl.deduction.estate.data it will be model_bpl_deduction_estate_data

这篇关于用户角色的OpenERP 7访问权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆