Trợ giúp

1

Permission for a group to edit a single field only?

Avatar
Shelton

Can we give permission for a group for editing only a single field in that model? None of the other fields shouldn't be edited..

Ảnh đại diện
Huỷ bỏ
5 Câu trả lời
3
Best Answer

Hi Shelton,

You can give permission for a group for editing only single field of model by defining :

<field name="Field_Name" groups="Group_Name">

Like that your group user can edit only Field_Name field which have access right.

Thank You, (SerpentCS Pvt. Ltd.)

1 Bình luận
Ảnh đại diện
Huỷ bỏ
Avatar
Mohammad Alhashash
-

This not practical. groups attribute completely blocks access to field (both read and write) for other groups. The poster want to allow certain groups to view all fields but only edit one field.

1
Avatar
Mohammad Alhashash
Best Answer

As I understand, you want to allow writing only to one field. Check this answer for information on how to control field access.

I think your best option is to use fields.property type for that field and create a record rule to control the access to the property and access rule to block writing to the main record.

Another option is to override create() and write() methods to check the group and access fields upon writing.

Check this answer for general information about access control.

Ảnh đại diện
Huỷ bỏ
1
Best Answer

You can try

'field1': fields.float(string='Field',write=['base.GROUP_ID']),

Only user belongs to GROUP_ID can change that field..

Regards, Mustufa Rangwala

4 Bình luận
Ảnh đại diện
Huỷ bỏ
Avatar
Mohammad Alhashash
-

Are sure write is a field attribute!!! I could not find any reference to this attribute in source code.

Avatar
Mustufa Rangwala (mra)
-

Hi Mohammad, Yes I am sure it is working with OpenERP 6.1 tested. The feature is like user who is not having that group can see that field but can not edit. If he/she try to edit OpenERP will remove that edit (does not save in to database..) ..

Avatar
Mustufa Rangwala (mra)
-

No, There is no specific document related to this...

Avatar
Prakash
-

Hello Mustufa, write only Permissions its working fine. Is there any way to show message to the End user for example other user try to modify field its shows "Sorry, you are not allowed to change this Field Data" Thanks

0
Best Answer

Check field access in http://odoo-80.readthedocs.org/en/latest/reference/security.html

You can use groups attr in field.

1 Bình luận
Ảnh đại diện
Huỷ bỏ
Avatar
Jérôme Thériault
-

Link's dead.

0
Avatar
omar
Best Answer

Even if it was working, it would affect the view only, not an actual security measure. Do you have any reference to this option in documentation or source?

Ảnh đại diện
Huỷ bỏ