Odoo Help


Calling QWeb template in Javascript

Axel Kerbec
on 10/27/16, 4:32 PM 261 views

Hello, is there a way I can render a QWeb template template from Javascript? As an example, I have the following template:


<template id="theme.tp_remove_button"> 
    <a class="btn btn-default tp_delete">
        <i class="fa fa-minus"></i>

Is there any way I can call it from my Javascript file in the frontend? I know that I can create static QWeb templates and render them, but that would mean that every piece of code I plan on redering on both the server and the client will need two separate templates!

Thank you for the help!


Hilar AK

--Hilar AK--
Hilar AK
| 5 3 7
--Hilar AK--

Hilar AK
On 10/31/16, 8:20 AM

var modal = qweb.render("your template", {                modal_title: modal_title,                modal_body: modal_body            });

or check the render function in qweb js

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 10/27/16, 4:32 PM
Seen: 261 times
Last updated: 10/31/16, 8:20 AM