تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
10361 أدوات العرض

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 ??

الصورة الرمزية
إهمال
أفضل إجابة

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)

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
3
سبتمبر 17
8707
1
يوليو 25
1706
1
مايو 25
1700
1
أبريل 25
2278
1
فبراير 25
1564