Sharing attachments

Rational

It is a common need for user to be able to share attachments with external people (using email).
Also these sharing may need to expire.

Proposal

A list (One2Many) of sharing secrets is added to the ir.attachment which can have an expiration date set.
The user can fill a comment to explain the sharing (ex: “Share with supplier XYZ”).
On creation link is generated like <database name>/ir/attachment/<id>/<secret>/<name>.
If an email address is set, an email is sent to the address with the link on creation. A button allow to resent the email. The email address is read-only to force user to delete and create new entry if the address must be changed.

When the web_shortener module is activated, it is used to shorten the URL instead of the long one.

In addition, we could also add an option to store as attachment a report that is generated and thus share it.

Implementation

3 Likes

I think that the user should also be able to invalidate a sharing secret.

It could work by just removing the the record from the O2M but in this case we lose the trace that the file was shared so maybe by setting the expiration date in the past.