콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
5931 화면

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')
아바타
취소
베스트 답변

The examples I saw are for odoo 9 and 10. I couldn't found any example for odoo 8, but instead of odoo you should try openerp. Odoo is use in later versions

아바타
취소