Create document_revision, document and link it to custom module record

I have custom button that generates ODT document based on record fields.
I have managed to upload that document into upload directory, create document revision, document and link between them.
Everything is done without beans and everything is working except there is no attachment icon / link for download.

Is there any howto or example on this subject available online?
Thx

Maybe you already know everything I wrote on this post

https://pgorod.github.io/How-Documents-Stored/

but maybe you can check it to see if there’s any piece missing from your puzzle…

… especially this part

make sure you add the filename in both places.