OdooWiki OCA HUB

Restrict Deletion of Attachments

attachment_delete_restrict folder_open OCA/server-tools open_in_new
Tools License: AGPL-3

This module provides the ability to restrict the deletion of the attachments at different levels.

auto_awesome What this module does

AI-generated from the code · Odoo 18.0

Control who is allowed to delete attachments in Odoo. Set a global rule, or a specific rule per document type, so only the creator, admins, or chosen users and groups can remove files.

This module adds deletion restrictions to attachments (files linked to records such as invoices, sales orders or contacts).

In Settings, under the user default rights block, you find "Restrict Deletion on Attachments". You choose a global level: no restriction, only the owner and administrators, a custom list of groups and users, or a combination of owner plus custom list. When a custom level is chosen, extra fields appear to pick the authorized groups and users.

On each model (document type) form, a "Restrict Attachment Deletion" field lets you override the global setting for that specific model, with the same choices. If you pick a custom level, you can also select the groups and users allowed to delete attachments for that model.

On user and group forms, a new "Attachment Deletion Models" tab lets you list the document types for which that user or group may delete attachments. Only models set to a custom restriction can be selected there.

When someone tries to delete an attachment without permission, Odoo blocks the action and shows an error listing the users who are allowed. Administrators and superusers are not restricted.

Depends on

basebase_setup
Models and fields (5)
  • ir.model · extends an existing modeldelete_attachment_user_ids (Attachment Deletion Users), restrict_delete_attachment (Restrict Attachment Deletion), delete_attachment_group_ids (Attachment Deletion Groups)
  • res.users · extends an existing modeldelete_attachment_model_ids (Attachment Deletion Models)
  • res.groups · extends an existing modeldelete_attachment_model_ids (Attachment Deletion Models)
  • ir.attachment · extends an existing model
  • res.config.settings · extends an existing modelglobal_delete_attachment_user_ids (Attachment Deletion Users), global_restrict_delete_attachment (Restrict Delete Attachments), global_delete_attachment_group_ids (Attachment Deletion Groups)

Text generated by AI (DeepSeek) from reading the Odoo 18.0 code on GitHub; it may contain mistakes, so check the code before deciding. View the code on GitHub

Availability by version

Reviewed: 2026-11-03
Confirmed (verified in repository and branch) Estimated (unverified) No information

Confirmation status: 4 confirmed, 5 with no information of 9 versions.

Sources · Odoo 14.0

Confirmed on 2026-11-03 in branch 14.0 of OCA/server-tools.

terminal Installation and usage

OCA documentation · Odoo 18.0

Select level:

  • Go to Settings \> General Settings\> Permission section.
  • Choose the level of Restrict Delete Attachment for all models by default or for models with "default" restriction level.

Five levels:

  • Default : Use global configuration
  • Owner : Owner and admins only
  • Custom : Certain groups or users per related model.
  • Owner + Custom : Owner, admins and Certain groups or users per related model.
  • None : all users can delete them

Only Custom and Owner + Custom need specific configuration on models.

For Custom and Owner + Custom levels:

  • Go to Settings \> Technical \> Database Structure \> Models.
  • Open a model for which attachment deletion should be restricted.
  • Select 'Restrict Attachment Deletion', and assign 'Attachment Deletion Groups' and/or 'Attachment Deletion Users' as necessary (if no assignment, no one can delete the attachments of this model).

For assigning 'Attachment Deletion Groups'/'Attachment Deletion Users' to the model, you can alternatively add the model in the 'Attachment Deletion Models' tab in the respective group/user form.

No verified information in OCA: Installation, Usage.

info

Data imported from GitHub: this sheet reflects the latest catalog review, not a live lookup. Always check the module documentation and staging before installing in production.