我正试图从向导那里得到一份报告,我指的是mi res_model:stock.quant来自我的回报:
def print_report(self, cr, uid, ids, context=None):
datas = {'partner' : context.get('cliente'), 'mounth':context.get('mes')}
return {
'type': 'ir.actions.report.xml',
#~ 'report_file': 'stock.uas.wizard',
'report_name': 'stock.report_uas_document',
'report_type': 'qweb-html',
'datas': datas,
'context': context,
'res_model': 'stock.quant',
'src_model': 'stock.quant',
}
我正在获取正确的模型和报告,但是当我尝试使用某个字段时,我收到此错误:
QWebException: "'NoneType' object has no attribute 'get_pallets'" while evaluating
如果我在模型中尝试一些函数,我会收到此错误:
QWebException: ('MissingError', you'One of the documents you are trying to access has been deleted, please try again after refreshing.')
就像我在另一个没有字段和函数的模型中那样名为la that.but if a do
<span t-esc="o"/>
在报告中
y get: stock.quant(42,)
所以问题是,如何从回报中获取和消费参数。
我认为我是在正确的对象,我用传统的方式和它的单词构建这个报告,但通过回调函数,我没有通过参数。
您的数据是字典,只有两个值。 要做到如上所述,试试这个:
def print_report(self, cr, uid, ids, context=None):
assert len(ids) == 1,
datas = {
'ids': ids,
'model': 'stock.quant',
'form': self.read(cr, uid, ids[0], context=context)
}
return {
'type': 'ir.actions.report.xml',
#~ 'report_file': 'stock.uas.wizard',
'report_name': 'stock.report_uas_document',
'report_type': 'qweb-html',
'datas': datas,
'context': context,
'res_model': 'stock.quant',
'src_model': 'stock.quant',
}