Skip to Content
Menu
This question has been flagged

Hey community, 

I am able to render template in odoo v15 but unable to achieve it in odoo v11 is there any method name change 

my v15 code:

@http.route(['/onclick/button'], type='json', auth='public', website=True)
def on_click_button(self, **kwargs):
value = {}
products = request.env['product.template'].search([])
value['product_list'] = request.env["ir.ui.view"]._render_template(
"js_example.p_name_template", {'products': products, 'flag': 'products'})
return value

My v11 code:

@http.route(['/onclick/button'], type='json', auth='public', website=True)
def on_click_button(self, **kwargs):
value = {}
products = request.env['product.template'].search([])
value['product_list'] = request.env["ir.ui.view"]._render_template(
"js_example.p_name_template", {'products': products, 'flag': 'products'})
return value

Avatar
Discard
Best Answer

Hello Sarvesh Sharma

Use "render_template" instead of "_render_template".




Thank you

Avatar
Discard
Related Posts Replies Views Activity
1
Nov 22
1489
2
Jan 23
3047
2
Nov 22
1923
1
Sep 22
1699
2
Aug 21
5529