Hi
I am using odoo 8
I want to build a custom web application using odoo web framework, I have a simple test template, this template has a button, this button is calling a javascript function that is trying to access odoo object (or openerp) to benefit from odoo web framework capabilities and access odoo ORM framework.
How to load odoo web framework so it will be accessible in my java scripts?
Javascript:
function my_func()
{ console.log("Debug statement: Start Clicked");
console.log("Debug statement: Execution Finished");
odoo.define('web.ajax', function (require) {
"use strict";
var time = require('web.time');
var Dialog = require('web.dialog');
});
}
Once the start button is clicked the log messages are showing, then getting the error message ReferenceError: odoo is not defined
Template:
<template id="timer" name="newpage.action">
<script type="text/javascript" src="/newpage/static/src/js/first.js"></script>
<link rel="stylesheet" href="/newpage/static/src/css/newpage.css"/>
<div id="my_div"/>
<div class="oe_newpage oe_newpage_stopped">
<h4 class="oe_newpage_timer">00:00:00</h4>
<p class="oe_newpage_start">
<button type="button" onclick="my_func()">Start</button>
</p>
<p class="oe_newpage_stop">
<button type="button">Stop</button>
</p>
</div>
</template>
Controller:
class Timer(http.Controller):
@http.route('/timer/', auth='public', website=True)
def orders(self, **kw):
return http.request.render('newpage.timer')