This question has been flagged

I have removed delete access from Employee group and its working perfectly in ir.attachment form view and tree view level, but the system is still allowing the user to remove attachment from many2many field(Access warning popup is shown, but still removing the attachment).


How to prevent a normal user from deleting a many2many_binary field?


Below is the field:

attachment_ids = fields.Many2many('ir.attachment', 'message_attachment_rel_1',  'message_id', 'attachment_id', string='Attachments', help='Attachments are linked to a document  ',  'through this field.', track_visibility='always')    

Below is the change in permission for Employee group:

base.access_ir_attachment_group_user,access_ir_attachment group_user,base.model_ir_attachment,base.group_user,1,1,1,0

Below is the error message:

Sorry, you are not allowed to delete this document. Only users with the following access level are currently allowed to do that:
- Sales/Manager
- Project/Manager

(Document model: ir.attachment)

Avatar
Discard
Best Answer

Hello Pranav,

Can you please check what are all the access rights available for it.attachment model

you will get it from Setting --> Technical --> Database structure --> model     (visible only dedug mode)

after that change what are all the groups mapped to the current user.

After observing these two you will get an idea.

Avatar
Discard