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.

1

Uncaught ReferenceError: openerp is not defined

By
Gopakumar N G
on 3/12/15, 3:37 AM 2,162 views

I have created a module named test_module with the following structure:

 

  • __init__.py
  • __openerp__.py
  • Views:
      template.xml
  • static
    -- src
         -- js
               -- test.js
  • controllers
      -- main.py
  • data
       -- data.xml
     

And in the template.xml I have specified the JS file as follows in a template

    <template id="test_template">
                <script type="text/javascript" language="JavaScript" src="/gastro_website/static/src/js/gastro_registration.js"/>

               <t t-call="website.layout">

                  -----------------------------

                 -------------------------------

               </t>

    </template>

 and the test.js file is

openerp.test_module = function (instance, local) {

     console.log('qqqqqqqqqqqqqqqqqqqqqqqqqqqqqq');

};

But on loading the page for the template shows in console of the browser:

    Uncaught ReferenceError: openerp is not defined

which is from the test.js file

How to fix this?

 

0
David Bertha
On 7/14/15, 9:13 AM

You should add the script by inheriting website.assets_frontend


<template id="assets_frontend" inherit_id="website.assets_frontend" name="My scripts">
<xpath expr="." position="inside">
<script type="text/javascript" src="..."></script>
</xpath>
</template>

I have added the script by inheriting website.assets_frontend, but it didn't resolve the problem.

Gopakumar N G
on 6/1/16, 2:45 AM

I think it should be website.assets_editor and not frontend

Tech Support
on 6/21/16, 1:58 PM

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

3 follower(s)

Stats

Asked: 3/12/15, 3:37 AM
Seen: 2162 times
Last updated: 7/14/15, 9:13 AM