Odoo Help

Welcome!

This community 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.

0

Calling QWeb template in Javascript

By
Axel Kerbec
on 10/27/16, 4:32 PM 185 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>
    </a>
</template>

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!

2

Hilar AK

--Hilar AK--
829
| 5 2 7
Italy
--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 community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

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