Naming Series for Attachments

Is there a way to rename attachments that are uploaded using a naming series based off of the doctype name?
for example, uploading an attachment to sales order renames the file to 'SO-customer ID-001

@CM2191 You can do it with custom app by using hooks:

doc_events = {
	"File": {
		"before_insert": "custom_app.custom_module.API.rename_attachment"
	}
}

In rename attachment, you have to writ the logic of renaming the file if reference doctype is a sales order

Hi ,
can you give some example of this fuction?

thanks

1 Like