From be47acac64df660820138a0721d0974aaec6cf76 Mon Sep 17 00:00:00 2001 From: Younn Olivier Date: Thu, 27 Oct 2022 12:28:55 +0000 Subject: [PATCH] [FIX] website: fix opening shared documents from the WebsitePreview Before this commit, following this flow: - From the documents app, click on the "share" icon of a document, - In the website builder, in edit mode, paste the link in the link tools, - Save and click on the link, => There is a traceback coming from cross-origins errors with the iframe. These documents should be opened in the top window, as it does not make sense to open the pdf viewer inside the iframe. This is defined in the website module, to avoid creating a website_documents module just to patch the WebsitePreview._isTopWindowURL method. [1]: 44da4bf task-2687506 closes odoo/odoo#107860 X-original-commit: 2e8fce06cbe4e2d24dd80eca1c59a9d44d181d30 Signed-off-by: Benoit Socias (bso) --- .../src/client_actions/website_preview/website_preview.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/website/static/src/client_actions/website_preview/website_preview.js b/addons/website/static/src/client_actions/website_preview/website_preview.js index 85329f8d61c..c7d4b675760 100644 --- a/addons/website/static/src/client_actions/website_preview/website_preview.js +++ b/addons/website/static/src/client_actions/website_preview/website_preview.js @@ -283,7 +283,10 @@ export class WebsitePreview extends Component { || (pathname && (backendRoutes.includes(pathname) || pathname.startsWith('/@/') - || pathname.startsWith('/web/content/'))); + || pathname.startsWith('/web/content/') + // This is defined here to avoid creating a + // website_documents module for just one patch. + || pathname.startsWith('/document/share/'))); } /**