Odoo Help

Welcome!

This community 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.

1

Programatically fill binary field v6.0 [Closed]

By
Max
on 4/18/13, 8:36 AM 1,557 views

The Question has been closed

by
Sudhir Arya (SA)
on 04/19/2013 15:30:57

I am generating and then saving a .zip file in python and need to save it in a binary field using the self.write(...) method. What kind of object should I pass as the value for the binary field in the write method?

1
Max
On 4/19/13, 7:09 AM

This did it:

file_base64 = ''
with open(file_path, "rb") as file:
    file_base64 = base64.b64encode(file.read())

self.write(cr, uid, id, {'file': file_base64})

About This Community

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

Question tools

0 follower(s)

Stats

Asked: 4/18/13, 8:36 AM
Seen: 1557 times
Last updated: 3/16/15, 8:10 AM