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

How to call javascript inside qweb template

By
navyareddy
on 6/20/16, 7:17 AM 744 views

hello,i want to call or execute javascript code inside the qweb template.i am trying t-js but its not working

0
navyareddy
On 6/20/16, 10:13 AM

in projects_report.xml file:

<template id="minimal_layout1">

<t t-raw="'&lt;base href=%s&gt;' % base_url"/>

&lt;!DOCTYPE html&gt;

<html style="height: 0;">

<head>

<script type="text/javascript">

function subst() {

alert("odoo");

document.write(5+6);

}

</script>

</head>

<body class="container" onload="subst()">

<t t-raw="body"/>

</body>

</html>

</template>

<t t-call="projects_report.minimal_layout1"/>

or

<template id="summernote1" name="Summernote">

<script type="text/javascript">

(function () {

alert("adsa global");

document.write("adsa");

})();

</script>

</template>

<t t-call="projects_report.summernote1"/>

am trying these types to call javascript inside the qweb but the function is not loading ,its not throwing any errors.i am very new to qweb can you plz solve this .


0
Lara
On 6/20/16, 8:56 AM

To help you better can you provide your code and the error / log ? 

Kind regards 

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: 6/20/16, 7:17 AM
Seen: 744 times
Last updated: 6/20/16, 10:13 AM