From 4de6618cdff70bbf5ca9a42ded57edd2e2f128eb Mon Sep 17 00:00:00 2001 From: Mitul Shah Date: Thu, 16 Sep 2021 07:20:16 +0000 Subject: [PATCH] [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) --- .../static/src/js/website_event_set_customize_options.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/addons/website_event/static/src/js/website_event_set_customize_options.js b/addons/website_event/static/src/js/website_event_set_customize_options.js index a6d9f749152..79b57c7c695 100644 --- a/addons/website_event/static/src/js/website_event_set_customize_options.js +++ b/addons/website_event/static/src/js/website_event_set_customize_options.js @@ -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($('
', { + class: 'dropdown-divider', + role: 'separator', + })); + } self.eventOptions.insertAfter(self.$el.find('.dropdown-divider:first()')); } });