Skip to Content
Menu
This question has been flagged
1 Atsakyti
10470 Rodiniai

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

Portretas
Atmesti
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)

Portretas
Atmesti
Related Posts Replies Rodiniai Veikla
3
rugs. 17
8792
1
liep. 25
1876
1
geg. 25
1961
1
bal. 25
2391
1
vas. 25
1682