Odoo Help

0
4 Answers
0
Sarender Reddy
12/18/17, 9:13 AM


<field name="datas" filename="filename" />

TO

<field name="datas"  widget="binary"  filename="filename" />

sure........ it will work.

0
Avatar

Avinash Nk

--Avinash Nk--

2131
| 4 3 7
Calicut, India
--Avinash Nk--

 

Avinash Nk
8/2/17, 12:33 AM

Hi marwa,
      
         The file_name field contains the name of the file you are uploading.
          
         The datas field contains the file you are uploading.
 
For decoding that file, you can use base64decoding. 

import base64
from odoo import api, fields, models

class YourClass(models.TransientModel):
_name = 'your.wizard'

datas = fields.Binary(string="File")
file_name = fields.Char(string="File Name")

@api.multi
def your_function(self):
file_encoded = base64.b64decode(self.datas)
0
Marwa ROMDHAN
8/2/17, 5:30 AM

Thanks for your response,

But I mean, In My view form I don't have the file name .

I have the content of file decoded !! I would appear the file name

Ask a Question
Writer
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