Skip to Content
Menu
This question has been flagged
1 Reply
9134 Views

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

Avatar
Discard
Best Answer

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)

Avatar
Discard
Related Posts Replies Views Activity
3
Sep 17
7602
0
Oct 24
118
1
Apr 24
972
7
Sep 24
22460
1
Mar 24
277