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)

tshepang
  • 12,111
  • 21
  • 91
  • 136
Nant
  • 41
  • 2

1 Answers1

1

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

Adrian Merrall
  • 2,509
  • 12
  • 9
  • Sorry, I wasnt able to connect to Inet, The field is added!, when I want to download the file it says "Download comprobante.pdf", but wen I get the file, the name es excepcion_n (n is the id number) without extension :/ – Nant Feb 12 '14 at 11:55