From d652fcb83090b226737bac2b0ea8eb899cac42c2 Mon Sep 17 00:00:00 2001 From: Romain Derie Date: Wed, 21 Dec 2022 15:49:18 +0000 Subject: [PATCH] [FIX] website: restore the redirect after lang install Since 2013 we have a kind of a URL hack that allows to redirect to the initial URL after installing a lang through the website, see [1]. It was even tested in python unit test with [2] but sadly it was still broken by a combination of [3] and [4] which actually broke it at the javascript level: the python view was correctly still outputting the correct URL and the python part was correctly handling that return URL when passed, but the javascript was not actually passing the URL from the view/href to the python side as the lang install wizard was now called through JS instead of a normal backend URL redirect (since the website frontend > backend imp at [4]). Step to reproduce: - Go to any page other than the homepage - Click on footer > add a language - Add a language - You are redirected to the homepage always instead of the URL you came from Note that this is only true if done through the backend / iframe preview as clicking on the "Add a language" from the frontend will work as it should. Indeed, when clicking on it from the frontend, it's a simple link redirect but when click in the iframe preview, the click is preventend to let the JS open the action in the top window instead. [1]: https://github.com/odoo/odoo/commit/5cfbcc3aff5a28022b397ec7a28ebaca6db43673 [2]: https://github.com/odoo/odoo/commit/269aa594111a152ad4b7714856ea745bfef57155 [3]: https://github.com/odoo/odoo/commit/11429329b8dea2dd0b2496dc8c1c8627751cccff [4]: https://github.com/odoo/odoo/commit/31cc10b91dc7762e23b4bde9b945be0c4ce3fe3b closes odoo/odoo#108869 X-original-commit: 05caf6e697461176326ee61beeccb1193472267c Signed-off-by: Quentin Smetz (qsm) Signed-off-by: Romain Derie (rde) --- .../src/client_actions/website_preview/website_preview.js | 2 +- addons/website/views/website_templates.xml | 2 ++ 2 files changed, 3 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 b965a5c5211..4219b79493f 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 @@ -353,7 +353,7 @@ export class WebsitePreview extends Component { additionalContext: { params: { website_id: this.websiteId, - url_return: '/[lang]', + url_return: $.deparam(href).url_return, }, }, }); diff --git a/addons/website/views/website_templates.xml b/addons/website/views/website_templates.xml index 8b3a99961e7..6f4708115fe 100644 --- a/addons/website/views/website_templates.xml +++ b/addons/website/views/website_templates.xml @@ -1929,6 +1929,8 @@