Currently, spreadsheet dashboards always display numbers with the en_US format, no matter the user's lang. That's because the locale is hardcoded in the spreadsheet source file, in the source code (or it falls back to the default en_US locale if it's missing). With this commit, we dynamically change the spreadsheet locale with the user's locale when he loads a dashboard. We can change the locale with every user because the dashboard is readonly. It cannot create a giant mess with dates in various locales. Limitation ---------- Since hardcoded date formats are not changed when the locale changes, dates will keep the en_US format. However, most (if not all) dates in dashboards are coming from ODOO.PIVOT and ODOO.LIST functions, which compute the formats dynamically based on the current locale. closes odoo/odoo#135119 Task: 3484002 Related: odoo/enterprise#47284 Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
17 lines
475 B
JavaScript
17 lines
475 B
JavaScript
/** @odoo-module */
|
|
|
|
import { registry } from "@web/core/registry";
|
|
|
|
registry
|
|
.category("mock_server")
|
|
.add("spreadsheet.dashboard/get_readonly_dashboard", function (route, args) {
|
|
const [id] = args.args;
|
|
const dashboard = this.models["spreadsheet.dashboard"].records.find(
|
|
(record) => record.id === id
|
|
);
|
|
return {
|
|
snapshot: JSON.parse(dashboard.spreadsheet_data),
|
|
revisions: [],
|
|
};
|
|
});
|