Reputation: 15
is it possible, in odoo 10, to upload a file in the form of a given model ? The user of the custom module has a list of items that he receives from is clients and he needs the invoices of thoses items. I imagine that this files are pdf files, but not necessarely (But I can tell to upload pdfs only if that is simple...).
The problem is, some times, in other technologies, a file is uploaded, but cannot be read when it is downloaded (some kind of corruption). So I really need to know how to do this in the sipliest and correct way.
Thank you So much for the help.
Upvotes: 1
Views: 4740
Reputation: 1631
in your model's py file
upload_file = fields.Binary(string="Upload File")
file_name = fields.Char(string="File Name")
in your xml form view file:
<field name="upload_file" filename="file_name"/>
<field name="file_name" invisible="1"/>
after uploading and saving file the download button shows and file retrived in save format which is uploaded
Upvotes: 5