You can achieve this using binary fields.Binary Fields Store file encoded in base64 in bytea column in your created table.
create binary field in models.py (in your desired model)
attachment = fields.Binary(string="Attachment")
store_fname = fields.Char(string="File Name")
In your xml file create below fields.
<field name="store_fname" invisible="1" />
<field name="attachment" filename="store_fname"/>
Now when ever you will upload some file (.pdf,.xlx,.doc etc) it will be downloaded with same name and with file extension.
For more reverence visit: http://learnopenerp.blogspot.com/2016/06/using-binary-fields-in-odoo.html
Hope it helps you and others.
Thanks