Field readonly and groups attribute

和自甴很熟 提交于 2019-12-10 11:24:08

问题


I wish to make a field readonly in Openerp 6.1 views.

I want the field to be readonly for all groups but specific groups, let's say manager should be able to edit it while others should be able to only view.

I am not clear how to do it in a view ? Please suggest. Thanks.


回答1:


you need to share more information about wht model(module ) and what view are we talking about.

It its a base module then the only way might be to inherit it and then make changes.

You can try the below short cut but I am not sure if it will work out for you.

go to Settings >> Customization >> Database Structure >> Fields >>

There find the field and model you want to change and then in security change it.




回答2:


You just create a functional field in your model which will be true if the user belong to manager group else false, then add attrs for your field so that it will be editable if the user belong to manager group or else readonly.

or you can try this method:

'your_field_name': fields.char(
    'Customer Reference',
    size=64,
    write=['base.group_partner_manager'],
    read=['base.group_user'],
    ),

You can find this in https://answers.launchpad.net/openobject-server/+question/178779




回答3:


OpenERP provide a facility to apply a restriction to specific group by accessright. let's take simple example if you have two group user and manager for model project.project and you allow that user can only read project and manager can read,write,update,delete a project.create two group user and manager and give rights you want to give. now apply this group on your field in xml for eg.groups="project.group_project_user"



来源:https://stackoverflow.com/questions/11580150/field-readonly-and-groups-attribute

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!