Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
1 Rispondi
10482 Visualizzazioni

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
Abbandona
Risposta migliore

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
Abbandona
Post correlati Risposte Visualizzazioni Attività
3
set 17
8802
1
lug 25
1958
1
mag 25
2042
1
apr 25
2476
1
feb 25
1748