in controller we use --> request.render() method to render qweb template but this isn't working in model how can i render qweb template throug model ??
此问题已终结
1
回复
12492
查看
Hi, here you have a snippet of code that works for me:
def _qweb_render(self, o=None):
val = {
'docs': o,
'doc_model': 'motor.record',
'doc_ids': [o.id],
}
html = self.pool["ir.ui.view"].render(self.env.cr, self.env.uid, 'yourmodule.your_view_xml_id, val, engine='ir.qweb', context=self.env.context).decode('utf8')
return HTMLSafe(html)
| 相关帖文 | 回复 | 查看 | 活动 | |
|---|---|---|---|---|
|
|
3
9月 17
|
10431 | ||
|
|
1
7月 25
|
5293 | ||
|
|
1
5月 25
|
6366 | ||
|
|
1
4月 25
|
4974 | ||
|
|
1
2月 25
|
4320 |