[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) <jpp@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
This commit is contained in:
Antoine (ande)
2023-03-10 14:39:13 +01:00
committed by Jorge Pinna Puissant
parent b6dd4beea6
commit a46d798fdb
2 changed files with 7 additions and 4 deletions
@@ -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;
}
}
+1 -1
View File
@@ -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, ''],
});
}