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

Javascript Options theme example of theme tutorial does not work.

By
Hendrik ten Hoor
on 8/13/16, 8:50 PM 240 views

I have been studying the theme tutorial and tried the examples. I have not been able to get the example about the "Java Options" to work. I followed the example exactly. I run the website in firefox. The debugger of firefox showes the following error:

"ReferenceError: openerp is not defined"


The java script code used looks as follows:

(function() {

'use strict';

var website = openerp.website;

website.openerp_website = {};

website.snippet.options.snippet_testimonial_options = website.snippet.Option.extend({

on_focus: function() {

alert("On focus!");

}

})

})();


The debugger points to the following line of the above function:

"var website = openerp.website;"


The template definition in the assets file looks as follows:

<template id="my_js" name="My Js" inherit_id="website.assets_editor">

 <xpath expr="script[last()]" position="after">

<script type="text/javascript" src="/theme_shipcenter/static/src/js/tutorial_editor.js" />

</xpath>

</template>



The examples are taken from the page

http://www.odoo.com/documentation/9.0/howtos/themes.html#snippet-options

I run the server and the browser on a Ubuntu 14.04 system.

Is there a mistake in the sample code or is there something missing?



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: 8/13/16, 8:50 PM
Seen: 240 times
Last updated: 8/14/16, 9:44 AM