Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie

Hello!

Since Odoo minify all JS, if i have two functions with same name, for the same view but in different modules, Odoo will execute the last one minified.

The order of minifying  JS is alphabetical with the name of the module, so in order to execute  the overwritten function I have to name the module after the original, to get my JS the last one in the minified JS file.

An example:

My code

great_project/static/src/js/kanban.js

openerp.great_project = function(instance) {
    var _t = instance.web._t, _lt = instance.web._lt;
    var QWeb = instance.web.qweb;

    instance.web_kanban.KanbanView.include({

        compute_cards_auto_height : function() {
              NEW CODE
        },

    });
};

 

Odoo code

web_kanban/static/src/js/kanban.js

openerp.web_kanban = function (instance) {

var _t = instance.web._t,
   _lt = instance.web._lt;
var QWeb = instance.web.qweb;
instance.web.views.add('kanban', 'instance.web_kanban.KanbanView');

instance.web_kanban.KanbanView = instance.web.View.extend({
    template: "KanbanView",
    display_name: _lt('Kanban'),
    default_nr_columns: 1,
    view_type: "kanban",
    quick_create_class: "instance.web_kanban.QuickCreate",
    number_of_color_schemes: 10,

compute_cards_auto_height: function() {
        if (!this.view.group_by) {
            var min_height = 0;
            var els = [];
            _.each(this.records, function(r) {
                var $e = r.$el.children(':first:not(.oe_kanban_no_auto_height)').css('min-height', 0);
                if ($e.length) {
                    els.push($e[0]);
                    min_height = Math.max(min_height, $e.outerHeight());
                }
            });
            $(els).css('min-height', min_height);
        }
    },

});

}

I dont know if there is a solution to this problem, just want to know what do you do in these cases.

Thank for your time, Jose Maria.

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
0
sie 23
194
1
lut 22
2790
0
sie 18
5786
0
lut 18
6482
1
lis 24
1767