我想将字典发送到我的qweb报告模板,但这给了我这样的错误:
TypeError:“ NoneType”对象不可下标
渲染编译AST时出错
TypeError:“ NoneType”对象不可下标
模板:1364
路径:/ templates / t / t / t / t / div / h1 / t
节点:
这是我的.py代码,位于yy models文件夹中:
class ReportMenumenu(models.AbstractModel):
_inherit = "my.model"
@api.model
def _get_report_values(self, docids, data=None):
data = {'this': 'test'}
return {
'doc_ids': self.ids,
'doc_model': self.model,
'data': data,
}
这是获取数据的报告模板:
<odoo>
<template id="my_module.report_name">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="o">
<t t-call="web.external_layout">
<div class="
<h1>
<t t-esc="data['this']"/>
</
</div>
</t>
</t>
</t>
</template></odoo>
你能帮我吗?谢谢。