2

I tried to import file to openerp 7 and I use the field binary but it doesn't give me the name of the file, just the content binary.

How can I recover the file name?

forvas
  • 9,801
  • 7
  • 62
  • 158

1 Answers1

0

Your Python model:

'source_file': fields.binary('Your binary file'),
'filename': fields.char('Filename'),

Your XML view:

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

And this way you will have the file name stored in the variable filename.

Hope it helps.

forvas
  • 9,801
  • 7
  • 62
  • 158
  • the problem is not totally solved. I need the complete path, but variable "filename" return just the filename – Harold Larson Oct 06 '15 at 14:28
  • Ok, you should specify that in your question. If you need the whole path, then this could help you: [http://stackoverflow.com/questions/21458155/get-file-path-from-binary-data](http://stackoverflow.com/questions/21458155/get-file-path-from-binary-data) – forvas Oct 06 '15 at 14:35
  • You're welcome @HaroldLarson. Please, don't forget to set the answer as correct to close the question, if you consider this one solved your problem. – forvas Oct 06 '15 at 16:19