Files
Lucas Lefèvre (lul) 67521df040 [FIX] spreadsheet_dashboard: handle missing dashboard
How to reproduce
1. Log in as Mitchel and go to a Subscription dashboard
2. Copy the URL and paste in incognito
3. Log in as Marc (which does have access to the subscription dashboard)

--> Traceback

closes odoo/odoo#153143

Task: 3581647
X-original-commit: 1c4b6b0a491d63d1f1b6c7a21089a42d4bfd64ab
Related: odoo/enterprise#56107
Signed-off-by: Pierre Rousseau (pro) <pro@odoo.com>
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
2024-02-08 15:07:57 +00:00

23 lines
665 B
JavaScript

/** @odoo-module */
import { RPCError } from "@web/core/network/rpc_service";
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
);
if (!dashboard) {
const error = new RPCError();
error.data = {};
throw error;
}
return {
snapshot: JSON.parse(dashboard.spreadsheet_data),
revisions: [],
};
});