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 ??
คำถามนี้ถูกตั้งค่าสถานะ
1
ตอบกลับ
12472
มุมมอง
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)
สนุกกับการพูดคุยนี้ใช่ไหม? เข้าร่วมเลย!
สร้างบัญชีวันนี้เพื่อเพลิดเพลินไปกับฟีเจอร์พิเศษและมีส่วนร่วมกับคอมมูนิตี้ที่ยอดเยี่ยมของเรา!
ลงชื่อ| Related Posts | ตอบกลับ | มุมมอง | กิจกรรม | |
|---|---|---|---|---|
|
|
3
ก.ย. 17
|
10407 | ||
|
|
1
ก.ค. 25
|
5242 | ||
|
|
1
พ.ค. 25
|
6198 | ||
|
QWeb: use t-if to check birthday date
แก้ไขแล้ว
|
|
1
เม.ย. 25
|
4943 | |
|
|
1
ก.พ. 25
|
4275 |