Skip to content

Commit 9712e17

Browse files
committed
imp: add fallback to /web/version
1 parent 3eea692 commit 9712e17

File tree

3 files changed

+28
-3
lines changed

3 files changed

+28
-3
lines changed

_locales/en/translation.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,10 @@
282282
"model": "The model technical name"
283283
},
284284
"definition": "Open thecnical documentation page",
285-
"detail": "Open thecnical documentation page."
285+
"detail": "Open thecnical documentation page.",
286+
"error": {
287+
"incompatibleOdooVersion": "This command is only available in Odoo 19.0+"
288+
}
286289
},
287290
"cmdEffect": {
288291
"args": {

_locales/es/translation.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,10 @@
282282
"model": "El nombre técnico del modelo"
283283
},
284284
"definition": "Abre la página de documentación técnica",
285-
"detail": "Abre la página de documentación técnica."
285+
"detail": "Abre la página de documentación técnica.",
286+
"error": {
287+
"incompatibleOdooVersion": "This command is only available in Odoo 19.0+"
288+
}
286289
},
287290
"cmdEffect": {
288291
"args": {

src/js/page/volatile/instance_analyzer.mjs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {InstanceContext, updateContext} from '@shared/context'; // This is the p
99

1010
type NetVersionInfo = [number, number, string, number];
1111

12-
const ODOO_OBJ: {...} = window.odoo;
12+
const ODOO_OBJ: {[string]: mixed} = window.odoo;
1313

1414
/**
1515
* Helper function to sanitize the server version.
@@ -60,6 +60,25 @@ async function getOdooVersionByNetwork(): Promise<{
6060
server_version: json_res.server_version,
6161
server_version_info: json_res.server_version_info,
6262
};
63+
} else {
64+
const req_data = new URLSearchParams();
65+
if (typeof ODOO_OBJ.csrf_token === 'string') {
66+
req_data.append('csrf_token', ODOO_OBJ.csrf_token);
67+
}
68+
const response_b = await fetch('/web/version', {
69+
method: 'POST',
70+
headers: {
71+
Accept: 'application/json',
72+
},
73+
body: req_data,
74+
});
75+
if (response_b.status === 200) {
76+
const json_res = (await response_b.json());
77+
return {
78+
server_version: json_res.version,
79+
server_version_info: json_res.version_info,
80+
};
81+
}
6382
}
6483
} catch (_err) {
6584
// Do nothing

0 commit comments

Comments
 (0)