Restrict access to delete attachment

Hi
again i ask , last time some one reply but i think he didn’t understand my question .

Is it possible in erpnext to restrict access to delete attachment ?

so staff can attach file or see attachment , but they can’t delete is .

Thanks

Your best option is to Try the solution he posted and let us know if it worked. So have you tried it?

no not worked ,
it’s not for attachment .

@ZYC Please create a issue on github

I have added css in app. It will disable attachment remove option for all user.

.attachment-row>.close {
	display: none!important;
}
1 Like

Hi all,

voting in on this topic, I believe it should be possible to restrict deletion/removal of attached files.

Use case: we have a DocType which has an external reference. This is added, then the DocType saved and submitted. After this, the external reference needs to be there (for later reference). If, then only a System Manager should be able to remove the file.

Actual behavior (Frappe Framework: v9.2.20 (master)): any user can open the submitted DocType record and remove the file. The field will still contain the original reference name, but the file is no longer there.

Should I open a ticket on GitHub?

1 Like

Thanks @kolate_sambhaji, this workaround worked (in combination with Build.json and custom CSS - #2 by revant_one ) No files can be deleted. Still I guess a full solution should be the aim.

2 Likes

@lasalesi We can add this in System Settings.
You can send pull request for this.

Sometimes we print a invoice and attach a listing of billed hours.
For that case we can not allow any user to delete that attachment.

The workaround with display: none is a very bad one. Any plans on adding a feature to prevent deleting attachments?

We can either hide it using
$(“.form-attachments”).hide();

But it’s not feasible to add for all documents and also addition will also be removed :neutral_face:
Suggesting restriction deletion of file instead :sweat_smile: