Odoo Help


[v9] How do I make sure my JS code runs after the code of some other module?

Javier Almancevo
on 1/10/16, 4:29 PM 529 views

There is a default module that makes a binding:

odoo.define('default_module', function(require) {
"use strict";
$('.some_class').on('change', 'some_selection', function() {

I need to create a module that removes that binding and adds another one, like this:

odoo.define('my_module', function (require) {
"user strict";
$('.some_class').off('change', 'some_selection');
$('.some_class').on('change', 'some_selection', function() {
..... //my new code

But obviously I need to make sure that the code of my module runs after the code of the default module. I believe that adding inside my_module the line:

var default_module = require('default_module');

 will make the code inside default_module always run before the code inside my_module. Can anyone confirm this is correct? If not, can anyone explain how to do it?


add that module to dependency list in a __odoo__.py manifest of your module

on 1/11/16, 4:57 AM

@Temur, I have done so, but is it having the default module as a dependency in my module __odoo__.py enough to guarantee that the default module javascript will run before my module javascript? We are not talking about python code, where that would be enough, but Javascript code.

Javier Almancevo
on 1/11/16, 7:02 AM

About This Community

This platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 1/10/16, 4:29 PM
Seen: 529 times
Last updated: 1/11/16, 6:17 AM