Skip to Content
Menu
This question has been flagged
1 Reply
2526 Views

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



Avatar
Discard
Author Best Answer

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: '()(.+)'
        });
    }
});
});
Avatar
Discard
Related Posts Replies Views Activity
0
Dec 17
3210
1
Jun 24
316
1
Jan 20
6685
1
Jul 19
2608
3
Jan 24
15292