[FIX] website_event: correctly display 'Event Sub-menu' customize menu

Right now, when we only have the website_event installed and ther are no
other regular(view based) customize menus available, we won't have a
divider div tag. And the current code tries to push our menu after
the first divider and thus fails due to no divider available.

With this commit, we simply check that if there's no existing divider
div, we simply add one and then push the menu after divider.

Task-2616588

closes odoo/odoo#77083

X-original-commit: 11a54d5fed9e21469363dabc4e973662418b9920
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This commit is contained in:
Mitul Shah
2021-09-23 16:05:59 +00:00
committed by Dharmraj Jhala
parent 9b43d7ec5a
commit 4de6618cdf
@@ -109,6 +109,13 @@ CustomizeMenu.include({
if (!self.__eventOptionsLoaded && self._getEventObject().model === 'event.event') {
self.__eventOptionsLoaded = true;
self.eventOptions = new EventSpecificOptions(self);
// If this is the first customize menu, add the divider at top
if (!self.$('.dropdown-divider').length) {
self.$('.dropdown-menu').append($('<div/>', {
class: 'dropdown-divider',
role: 'separator',
}));
}
self.eventOptions.insertAfter(self.$el.find('.dropdown-divider:first()'));
}
});