How to make connection of javascript with odoo?
For example:- I declared a button in xml and written a function in javascript then how to call that function on xml button.
My code is :-
xml button declaration:-
<footer>
<button name="button" onclick="updatetxt(fun)" string="ok"/>
</footer>
javascript and xml connection code:-
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template id="assets_backend" name="Javascript_Test" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<!-- <link rel="stylesheet" href="/web/static/lib/bootstrap/css/bootstrap.css"/> -->
<!-- <link rel="import" href="//static/src/timesheet.html"/> -->
<script type="text/javascript" src="/Javascript_Test/static/src/js/document.js"/>
</xpath>
</template>
</data>
</openerp>
javascript code:-
function updatetxt()
{
alert("hello");
}
manifeast file:-
'data': [
'views/views.xml',
'views/java_script.xml',
],
'js': [
'static/src/js/document.js'
],
So how to declare javascript on button with xml in odoo?
Hi, I've changed your question title from " How to integrate js with Odoo" to "how to call javascript function on button with xml in odoo?".