Odoo Help


Download binary files with original format

Manuel Pérez
on 1/5/15, 6:13 AM 6,818 views

Hi gurus!

I'd like to know how to download uplodaded binary files in the original format, the way it's done for attachments.

Thanks in advance,


+1 i'm also interested in this. Is there a built-in method in Odoo to convert between base64 and the original upload format for a specific file? Please post here back if you figure this out, i'll do likewise.

Luke Branch
on 1/5/15, 8:39 PM

Not sure of what you mean by downloading uploaded binary files (which files are these?) On the base64 that @Luke mentioned, python string object had already provide methods for encoding (http://www.tutorialspoint.com/python/string_encode.htm) and decoding (http://www.tutorialspoint.com/python/string_decode.htm).

on 1/6/15, 3:50 AM

Hi Ivan - do you know of any concrete example in any of the existing addons? I'd specially like to do it following the new API standards, thanks in advance.

Manuel Pérez
on 1/15/15, 11:50 AM

@Manuel. Sorry, I haven't explored the new API standard yet. AFAIK, it should be the same regardless of the API standard. You can just try to search/grep for method name to search for example.

on 1/16/15, 2:01 AM
on 6/7/17, 7:05 AM
Marvin Haß
On 1/6/15, 5:10 AM

Sorry, i have not enught karma for comments

This works only in FormViews:

have you tried to add the attribute "filename" in your XML-File:


class my_binary(models.Model):
    _name = 'arts.bewerber'

    binary = fields.Binary('Binray')

    binary_fname = fields.Char('Binary Name')


<field name="binary" filename="binary_fname"/>

<field name="binary_fname" invisible="1"/>


Im actually loocking for an solution in TreeViews :-(

Manuel Pérez
On 1/9/15, 1:48 PM

Hi Marvin,

Yes I have indeed tried after your answer, but without success.. any other advice? The code:

class product_image(models.Model):
    _name = 'product.image'

    name = fields.Char(string='Name')
    image = fields.Binary(string='Image')
    image_fname = fields.Char(string='File name')
    product_tmpl_id = fields.Many2one('product.template', string='Product')

And the XML:

<field name="image" string="Image" filename="image_fname"/>
<field name="image_fname" invisible="1"/>

The filename is displayed on the binary field link, but when downloading the file it's a .bin file, not the original one.



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

Question tools

6 follower(s)


Asked: 1/5/15, 6:13 AM
Seen: 6818 times
Last updated: 7/11/17, 6:43 AM