Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
10354 Zobrazení

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
Zrušit
Nejlepší odpověď

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
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
3
zář 17
8705
1
čvc 25
1698
1
kvě 25
1682
1
dub 25
2268
1
úno 25
1555