Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
Hi. I trying to save some data to Binary field for the sake to open it in browser and save on computer. Code is like this:
# -*- coding: utf-8 -*-
from openerp import api, fields, models
_name = "account.invoice.export.1c"
_description = "Exports invoice for 1c client bank"
mdata = fields.Binary('File', readonly=True)
def default_get(self, fields):
f = cStringIO.StringIO()
out = base64.encodestring(f.getvalue())
self.mdata = out
res = super(ExportInvoice1C, self).default_get(self, fields)
Then i got error on line self.mdata = out :
raise ValueError("Expected singleton: %s" % self)
ValueError: Expected singleton: account.invoice.export.1c()
Why i cant write binary file to this field ?
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
|Asked: 1/14/16, 4:48 AM|
|Seen: 897 times|
|Last updated: 1/14/16, 4:58 AM|