Nant
Nant

Reputation: 41

Filename stored in binary field in OpenERP 7.0

I've got a binary field and it works fine, but when I download the stored file, it has no extension. I specified 'pdf' extension, but it doesn't seems to work and I don't know why!

Here's the code

class exc(osv.osv):
_name = "exc"
_description = "exc"
_columns = {
'imp': fields.many2one('ins.imp', 'Imp'),
'fecha_A': fields.date('Fecha A'),
'fecha_B': fields.date('Fecha B'),
'comentarios': fields.text('Comentarios'),
'comprobante_fname': fields.char('Comp', size=32, readonly=True),
'comprobante': fields.binary(string='Comprobante'), #, filters='*.pdf'),

#agregar scan del certificado real como objeto binario ---- no obligatorio
}

_defaults = {
    'comprobante_fname': 'comprobante.pdf',
}

excepcion()

And the XML

...
    <field name="comprobante" filename="comprobante_fname" string="Comprobante"/>
...

(The filter in the binary field does't work either)

Upvotes: 0

Views: 2049

Answers (1)

Adrian Merrall
Adrian Merrall

Reputation: 2499

Have you included the file name field "comprobante_fname" on the form? You can make it invisible="1" if you don't want the user to see it.

You can also use a functional field here if you want to add some context to the file name such as report_customer_abc_feb_2014.pdf

Upvotes: 1

Related Questions