From a46d798fdb082ac16ee5ec8bb81863d08a2269c7 Mon Sep 17 00:00:00 2001 From: "Antoine (ande)" Date: Wed, 1 Mar 2023 17:50:42 +0000 Subject: [PATCH] [FIX] web: parse server version in url to doc To reproduce the issue: 1. In settings, scroll to "Contacts" 2. Click on the "?" bubble next to "Send SMS" 3. The page that opens is 404 Error: In the url of the opened page, there is "saas~16.1+e" instead of "saas-16.1" Added parsing to the server version in url OPW-3198672 closes odoo/odoo#114941 X-original-commit: 424ec17af513de0a55fd946e6494a425c9fff39e Signed-off-by: Jorge Pinna Puissant (jpp) Signed-off-by: Aaron Bohy (aab) --- .../widgets/documentation_link/documentation_link.js | 9 ++++++--- addons/web/static/tests/setup.js | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/addons/web/static/src/views/widgets/documentation_link/documentation_link.js b/addons/web/static/src/views/widgets/documentation_link/documentation_link.js index cc7e20523ae..d33a5adf94c 100644 --- a/addons/web/static/src/views/widgets/documentation_link/documentation_link.js +++ b/addons/web/static/src/views/widgets/documentation_link/documentation_link.js @@ -19,9 +19,12 @@ export class DocumentationLink extends Component { if (LINK_REGEX.test(this.props.path)) { return this.props.path; } else { - const serverVersion = session.server_version.includes("alpha") - ? "master" - : session.server_version; + const serverVersion = session.server_version_info.includes("final") + ? `${session.server_version_info[0]}.${session.server_version_info[1]}`.replace( + "~", + "-" + ) + : "master"; return "https://www.odoo.com/documentation/" + serverVersion + this.props.path; } } diff --git a/addons/web/static/tests/setup.js b/addons/web/static/tests/setup.js index 47cf5021ea9..57c0afc3802 100644 --- a/addons/web/static/tests/setup.js +++ b/addons/web/static/tests/setup.js @@ -268,7 +268,7 @@ function patchSessionInfo() { }, db: "test", server_version: "1.0", - server_version_info: ["1.0"], + server_version_info: [1, 0, 0, "final", 0, ''], }); }