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 ??
Pertanyaan ini telah diberikan tanda
1
Balas
12460
Tampilan
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)
Menikmati diskusi? Jangan hanya membaca, ikuti!
Buat akun sekarang untuk menikmati fitur eksklufi dan agar terlibat dengan komunitas kami!
Daftar| Post Terkait | Replies | Tampilan | Aktivitas | |
|---|---|---|---|---|
|
|
3
Sep 17
|
10375 | ||
|
|
1
Jul 25
|
5154 | ||
|
|
1
Mei 25
|
6096 | ||
|
QWeb: use t-if to check birthday date
Diselesaikan
|
|
1
Apr 25
|
4872 | |
|
Odoo 17 - QWeb Reports with External Datasource
Diselesaikan
|
|
1
Feb 25
|
4221 |