[FIX] website: permit to save when two TOC are on the same page

Since [this commit], when dropping several "table of content" blocks on
the same page, it was impossible to save. This commit solves this
problem.
Steps to reproduce the resolved bug:
- In edit mode, drop two TOC blocks
- Click on Save

=> the UI is blocked

[this commit]: https://github.com/odoo/odoo/commit/06b03ba5ef8375b1236f6ecb52ac468124e910ba

Related to opw-3047375
Related to opw-3035502
task-2948895

X-original-commit: a6de596017cdbd0da10b4050da132d46dc82a491
Part-of: odoo/odoo#107732
This commit is contained in:
Guillaume (gdi)
2022-12-14 18:33:14 +01:00
parent 8ed49e3e0a
commit 400fa9e9f4
3 changed files with 22 additions and 1 deletions
@@ -25,7 +25,10 @@ const TableOfContent = publicWidget.Widget.extend({
if (indexCallback >= 0) {
extraMenuUpdateCallbacks.splice(indexCallback, 1);
}
this._scrollingElement.scrollspy('dispose');
const scrollSpyInstance = ScrollSpy.getInstance(this._scrollingElement);
if (scrollSpyInstance) {
scrollSpyInstance.dispose();
}
this.$el.css('top', '');
this.$el.find('.s_table_of_content_navbar').css('top', '');
this._super(...arguments);
@@ -0,0 +1,15 @@
/** @odoo-module */
import wTourUtils from 'website.tour_utils';
wTourUtils.registerWebsitePreviewTour('snippet_table_of_content', {
test: true,
url: '/',
edition: true,
}, [
wTourUtils.dragNDrop({id: 's_table_of_content', name: 'Table of Content'}),
wTourUtils.dragNDrop({id: 's_table_of_content', name: 'Table of Content'}),
// To make sure that the public widgets of the two previous ones started.
wTourUtils.dragNDrop({id: 's_banner', name: 'Banner'}),
...wTourUtils.clickOnSave(),
]);
+3
View File
@@ -49,3 +49,6 @@ class TestSnippets(HttpCase):
def test_07_image_gallery(self):
self.start_tour(self.env['website'].get_client_action_url('/'), 'snippet_image_gallery', login='admin')
def test_08_table_of_content(self):
self.start_tour(self.env['website'].get_client_action_url('/'), 'snippet_table_of_content', login='admin')