【发布时间】:2017-12-27 07:14:24
【问题描述】:
我想通过 get_pdf 函数将变量自动保存到 fields.binary (email_attachment_file) 中。
我的代码如下:
class example_example(models.Model):
email_attachment_file = fields.Binary('Data (.txt,.pdf)')
email_filename = fields.Char('Filename')
def generate(self,etc..):
report_name = "report_name_template"
datas = {
'ids':[],
'model' : etc,
'form' : etc
'context': context
}
moddelReport = self.pool.get('report')
alpha = modelReport.get_pdf(cr, uid,[],report_name,None,datas,context=context)
#alpha = base64.decodestring(alpha)
#alpha = alpha.decode('unicode_escape').encode('utf-8')
# --------- how to save alpha variable into fields.binary
而且,modelReport.get_pdf 函数有什么问题吗?
【问题讨论】: