Odoo Help

0

how can i render template in model ??

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

0
GrupoCITEC
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.

Register

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)

Stats

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