Odoo Help

Frédéric Van Der Essen (fva)
On 1/31/13, 10:17 AM

Yes! First You'll need to create your own module, and set the module you want to modify as a dependency of your new module in the __openerp__.py file : 'depends': ['module_I_want_to_extend'],

Then you need to create your javascript file, and put it in the standard place : module/static/src/js/file.js and then add to the list of js files to load in __openerp__.py : js:['static/src/js/file.js'],

file.js will be executed after the code of the module you want to extend, so you have the oportunity to redefine and modify everything you want. Here's a sample js file that overrides the bar() method of the Foo class of the sample module.

openerp.new_module = function(instance){
    var module = instance.sample // loading the namespace of the 'sample' module

        bar : function(){
            this._super();  // calling the original Foo.bar() method

That'll work, but... if the Foo class has sub classes, those sub classes will not inherit your modifications. If you need to do that, you can use include() instead of extend().

Nicolas Vanhoren (niv)
on 1/31/13, 10:20 AM

That is true, I'll edit the answer ( I originally used module.Foo.extend({...}) )

Frédéric Van Der Essen (fva)
on 1/31/13, 10:55 AM

You got an error in the code example : module.Foo = module.Foo.include({... will assign undefined to module.Foo. You just have to use module.Foo.include({... alone, this will "edit in place"

Fabien Meghazi (fme)
on 1/31/13, 11:09 AM

owkay ! edited.

Frédéric Van Der Essen (fva)
on 1/31/13, 11:51 AM

I have a situation when my module loads I want to make a call to another module which is not jet in instance object. Is there any way to delay initialization of my module till all other modules are in instance object?

on 3/20/14, 9:58 AM
Nicolas Vanhoren (niv)
On 1/31/13, 10:09 AM

The technical documentation is located here:


In the web part, you will find documentation on how to write web modules and some reference documentation.

After that, there are many tricks to override a module behavior. A typical one would be to use the Class.include() method to modify an existing class, overriding whatever methods it defines.

Frédéric Van Der Essen (fva)
On 2/19/13, 12:20 PM

Oh, and by the way, the answer above (cannot edit...) Only works if module.Foo extends instance.web.Class native JS objects, or Backbone objects do not provide an include() method. So you have to do it by hand.

openerp.new_module = function(instance){
    var module = instance.sample; // loading the namespace of the 'sample' module

    var _super_ = module.Foo.prototype.bar;

    module.Foo.prototype.bar = function(){

Hello, I am trying to inheriting var Pos from point_of_sale from openerp 6.1 module to override get_app_data() function please help me. Here is my code for referance which gives error "module is undefined": This is my inherited js file:

openerp.my_pos = function(instance){

instance.my_pos = {};

var module = instance.point_of_sale;

var _super_ = module.Pos.prototype.get_app_data;

module.Pos.prototype.get_app_data = function(){


on 3/7/13, 5:51 AM
Carlos Almeida
On 11/3/15, 2:25 AM

How to load js, in the web/database/manager form?

It seems this doesn't work on login form or before login

I even started odoo with --load web,mymodule adding .js in assets and they are not loaded.

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

2 follower(s)


Asked: 1/31/13, 10:00 AM
Seen: 21728 times
Last updated: 7/5/17, 12:36 PM