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 ??
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Accounting
- Inventory
- PoS
- Project management
- MRP
This question has been flagged
1
Reply
9134
Views
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)
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign upRelated Posts | Replies | Views | Activity | |
---|---|---|---|---|
|
3
Sep 17
|
7602 | ||
|
0
Oct 24
|
118 | ||
|
1
Apr 24
|
972 | ||
|
7
Sep 24
|
22460 | ||
|
1
Mar 24
|
277 |