Odoo Help


how can i render template in model ??

on 4/8/15, 6:22 AM 1,448 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 ??

On 8/16/15, 5:31 PM

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)

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 4/8/15, 6:22 AM
Seen: 1448 times
Last updated: 8/16/15, 5:31 PM