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
- MRP
This question has been flagged
1
Reply
10339
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
|
8674 | ||
|
1
Jul 25
|
1652 | ||
|
1
May 25
|
1622 | ||
|
1
Apr 25
|
2234 | ||
|
1
Feb 25
|
1523 |