Odoo Help

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


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

TO

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

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

0
Marwa ROMDHAN
On 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

0
Avatar

Avinash Nk

--Avinash Nk--

2096
| 4 3 6
Calicut, India
--Avinash Nk--

 

Avinash Nk
On 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)

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Odoo Training Center

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

Test it now

Question tools

1 follower(s)

Stats

Asked: 8/1/17, 9:05 AM
Seen: 1452 times
Last updated: 12/18/17, 9:13 AM