Odoo Help

1 Answer
Rutvi Kathiriya
2/11/19, 5:04 AM

You have to define one char field to save a binary file.
In your case :

Py File:
file1 = fields.Binary("Upload file1")
file1_name = fields.Char('File Name1')
file2 = fields.Binary("Upload file2")

file2_name = fields.Char('File Name2')

XML File :
<field name="file1" filename="file1_name"/>
<field name="file1_name" invisible="1"/>
<field name="file2" filename="file2_name"/>
<field name="file2_name" invisible="1"/>

Hope it will works for you.
1 Comment
2/11/19, 8:30 AM

Well the problem is that I cant have those files saved to my models directory, thus I get this error when I pass each file's name to the function:

FileNotFoundError: [Errno 2] No such file or directory:

I have googled it and I have found that the files uploaded will be stored in the database but I want them to be saved to my models directory

Ask a Question
Keep Informed
1 follower(s)
About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now