Skip to Content
मेन्यू
This question has been flagged
1 Reply
10460 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
सित॰ 17
8784
1
जुल॰ 25
1854
1
मई 25
1935
1
अप्रैल 25
2377
1
फ़र॰ 25
1668