Odoo Help

0

How to call javascript inside qweb template

By
navyareddy
on 6/20/16, 7:17 AM 1,134 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 

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.

Register

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)

Stats

Asked: 6/20/16, 7:17 AM
Seen: 1134 times
Last updated: 6/20/16, 10:13 AM