Skip to Content
Menu
This question has been flagged
1 Reply
2334 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?

Thanks,

Avatar
Discard

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

Author

@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.