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 ??
To pytanie dostało ostrzeżenie
1
Odpowiedz
12482
Widoki
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)
Podoba Ci się ta dyskusja? Dołącz do niej!
Stwórz konto dzisiaj, aby cieszyć się ekskluzywnymi funkcjami i wchodzić w interakcje z naszą wspaniałą społecznością!
Zarejestruj się| Powiązane posty | Odpowiedzi | Widoki | Czynność | |
|---|---|---|---|---|
|
|
3
wrz 17
|
10427 | ||
|
|
1
lip 25
|
5268 | ||
|
|
1
maj 25
|
6255 | ||
|
QWeb: use t-if to check birthday date
Rozwiązane
|
|
1
kwi 25
|
4959 | |
|
|
1
lut 25
|
4305 |