Odoo Help

4

2
2 Answers
3
Marvin Haß Germany
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:

PY:

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

    binary = fields.Binary('Binray')

    binary_fname = fields.Char('Binary Name')

XML:

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

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

 

Im actually loocking for an solution in TreeViews :-(

0
Manuel Pérez Spain
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.

Thanks,

Manuel.

Ask a Question
Writer
Tag
Keep Informed
6 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.

Register
Odoo Training Center

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

Test it now