Skip to Content
Menu
This question has been flagged
1 Reply
2919 Views

Hi,odoo Community:

    I have code in py:

   

MyFile = fields.Binary()

    And code in xml:

<field name="MyFile"/>

    Once I uploaded file through "MyFile",it display file name,but after I clicked "Save" button,then clicked "Edit" again,it 

lost file name and display “436Bytes”(my file's size),then I download the file,it names "NULL",so how should I change my

code to keep MyFile's name after saving and download the   original file?

   Thanks for your help!           

                          

                                                                                                                                                                                                                           

Avatar
Discard
Best Answer

Hi Fabia,

Try something like this:

In Python

data_file = fields.Binary(string='Name')
filename = fields.Char()

In XML

<field name="data_file" filename="filename"/>
<field name="filename" invisible="1"/>



Thanks & Regards

Avinash N K

Avatar
Discard
Author

Thanks,it works.

My pleasure