콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다

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.

아바타
취소
관련 게시물 답글 화면 활동
0
8월 23
194
1
2월 22
2971
0
8월 18
5904
0
2월 18
6614
1
11월 24
1920