跳至内容
菜单
此问题已终结
1 回复
10352 查看

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 ??

形象
丢弃
最佳答案

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
8702
1
7月 25
1688
1
5月 25
1674
1
4月 25
2262
1
2月 25
1550