Pular para o conteúdo
Menu
Esta pergunta foi sinalizada
1 Responder
10365 Visualizações

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
Cancelar
Melhor resposta

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
Cancelar
Publicações relacionadas Respostas Visualizações Atividade
3
set. 17
8709
1
jul. 25
1712
1
mai. 25
1708
1
abr. 25
2281
1
fev. 25
1566