Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
4894 Vizualizări

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.

Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
0
aug. 23
194
1
feb. 22
2803
0
aug. 18
5797
0
feb. 18
6494
1
nov. 24
1791