跳至內容
選單
此問題已被標幟
1 回覆
3232 瀏覽次數

A value is needed to be modified in start: function of var EditMenuDialog of odoo website.contentMenu.js file . I want to modify a number in my custom module. The maxLevels need to be changed to 3 from 2.

\https://github.com/odoo/odoo/blob/10.0/addons/website/static/src/js/website.contentMenu.js#L210

In here maxLevels is set to 2 by default in odoo:

start: function () {
    var r = this._super.apply(this, arguments);
    this.$('.oe_menu_editor').nestedSortable({
        listType: 'ul',
        handle: 'div',
        items: 'li',
        maxLevels: 2,
        toleranceElement: '> div',
        forcePlaceholderSize: true,
        opacity: 0.6,
        placeholder: 'oe_menu_placeholder',
        tolerance: 'pointer',
        attribute: 'data-menu-id',
        expression: '()(.+)', // nestedSortable takes the second match of an expression (*sigh*)
    });
    return r;
},

I need to change the maxLevels to 3. How can I do that by inheriting it?

TIA



頭像
捨棄
作者 最佳答案

Following is the solution:

odoo.define('your_module_name.js_name', function (require) {
'use strict';
// assign the variable EditMenuDialog of website module's contentModule
// js in a variable
var EditMenuDialog = require('website.contentMenu').EditMenuDialog;

// for modifying use the .include function EditMenuDialog.include({
    start: function () {
        this.$('.oe_menu_editor').nestedSortable({
            listType: 'ul',
            handle: 'div',
            items: 'li',
            maxLevels: 3, // changed maxLevels from 2 to 3
            toleranceElement: '> div',
            forcePlaceholderSize: true,
            opacity: 0.6,
            placeholder: 'oe_menu_placeholder',
            tolerance: 'pointer',
            attribute: 'data-menu-id',
            expression: '()(.+)'
        });
    }
});
});
頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
0
12月 17
3974
1
6月 24
1209
1
1月 20
7848
1
7月 19
3638
3
1月 24
17312