mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
update demo data for actions
This commit is contained in:
+113
-19
@@ -8,25 +8,7 @@
|
||||
parent_id: false,
|
||||
action: "ir.actions.client,131",
|
||||
icon: "fa fa-comment",
|
||||
children: [
|
||||
{
|
||||
id: 97,
|
||||
name: "Integrations",
|
||||
parent_id: 96,
|
||||
action: false,
|
||||
icon: false,
|
||||
children: [
|
||||
{
|
||||
id: 188,
|
||||
name: "Github Repositories",
|
||||
parent_id: 97,
|
||||
action: "ir.actions.act_window,233",
|
||||
icon: false,
|
||||
children: []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
children: []
|
||||
},
|
||||
{
|
||||
id: 205,
|
||||
@@ -107,4 +89,116 @@
|
||||
window.demoData = {
|
||||
menus: menus
|
||||
};
|
||||
|
||||
const actions = [
|
||||
{
|
||||
id: 131,
|
||||
type: "ir.actions.client",
|
||||
target: "current",
|
||||
name: "Discuss",
|
||||
tag: "mail.discuss"
|
||||
},
|
||||
{
|
||||
id: 250,
|
||||
type: "ir.actions.act_window",
|
||||
name: "Notes",
|
||||
target: "current",
|
||||
domain: false,
|
||||
context: "{}",
|
||||
views: [[false, "kanban"], [false, "list"], [false, "form"]],
|
||||
res_id: 0,
|
||||
res_model: "note.note"
|
||||
},
|
||||
{
|
||||
id: 597,
|
||||
type: "ir.actions.act_window",
|
||||
name: "Pipeline",
|
||||
target: "current",
|
||||
domain: false,
|
||||
context: { default_team_id: 1 },
|
||||
views: [[2103, "kanban"], [2106, "list"], [2105, "form"]],
|
||||
res_id: 0,
|
||||
res_model: "crm.lead"
|
||||
},
|
||||
{
|
||||
id: 1051,
|
||||
type: "ir.actions.act_window",
|
||||
name: "Quotations",
|
||||
target: "current",
|
||||
domain: false,
|
||||
context: "{'search_default_my_quotation': 1}",
|
||||
views: [
|
||||
[3387, "list"],
|
||||
[3385, "kanban"],
|
||||
[3389, "form"],
|
||||
[3382, "calendar"],
|
||||
[3384, "pivot"],
|
||||
[3383, "graph"]
|
||||
],
|
||||
res_id: 0,
|
||||
res_model: "sale.order"
|
||||
},
|
||||
{
|
||||
id: 275,
|
||||
type: "ir.actions.act_window",
|
||||
name: "Team Pipelines",
|
||||
target: "current",
|
||||
context: "{}",
|
||||
domain: "[('use_opportunities', '=', True)]",
|
||||
views: [[false, "kanban"], [false, "form"]],
|
||||
res_id: 0,
|
||||
res_model: "crm.team"
|
||||
},
|
||||
{
|
||||
id: 595,
|
||||
type: "ir.actions.act_window",
|
||||
name: "Leads",
|
||||
target: "current",
|
||||
context:
|
||||
"{ 'default_type':'lead', 'search_default_type': 'lead', 'search_default_to_process':1, }",
|
||||
domain: "['|', ('type','=','lead'), ('type','=',False)]",
|
||||
views: [
|
||||
[2098, "list"],
|
||||
[2099, "kanban"],
|
||||
[2100, "calendar"],
|
||||
[2108, "pivot"],
|
||||
[2107, "graph"],
|
||||
[false, "form"]
|
||||
],
|
||||
res_id: 0,
|
||||
res_model: "crm.lead"
|
||||
},
|
||||
{
|
||||
id: 1083,
|
||||
type: "ir.actions.act_window",
|
||||
name: "Scores",
|
||||
target: "current",
|
||||
context: "{}",
|
||||
domain: false,
|
||||
views: [[false, "list"], [false, "kanban"], [false, "form"]],
|
||||
res_id: 0,
|
||||
res_model: "website.crm.score"
|
||||
}
|
||||
];
|
||||
|
||||
window.demoData.mockAjax = async function(route, params) {
|
||||
console.log("RPC", route, params);
|
||||
|
||||
// wait some random delay
|
||||
const delay = Math.random() * 1000;
|
||||
await new Promise(resolve => setTimeout(resolve, delay));
|
||||
|
||||
// mock action
|
||||
if (route === "web/action/load") {
|
||||
const action = actions.find(a => a.id === params.action_id);
|
||||
if (action) {
|
||||
return action;
|
||||
} else {
|
||||
throw new Error("cannot find action");
|
||||
}
|
||||
}
|
||||
// unknown route
|
||||
console.warn("Unknown route", route);
|
||||
return true;
|
||||
};
|
||||
})(window);
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
export type RPC = (route: string, params: any) => Promise<any>;
|
||||
|
||||
export const rpc: RPC = async function(route, params) {
|
||||
console.log("RPC", route, params);
|
||||
const delay = Math.random() * 1000;
|
||||
return new Promise(resolve => setTimeout(resolve, delay));
|
||||
return (<any>window).demoData.mockAjax(route, params);
|
||||
};
|
||||
|
||||
@@ -26,11 +26,28 @@ export interface ActWindowInfo extends CommonActionInfo {
|
||||
view: string;
|
||||
}
|
||||
|
||||
export interface ActionDescription {
|
||||
interface BaseActionDescription {
|
||||
id: number;
|
||||
type: "ir.actions.act_window" | "ir.actions.client";
|
||||
target: "current";
|
||||
name: string;
|
||||
}
|
||||
interface ClientActionDescription extends BaseActionDescription {
|
||||
type: "ir.actions.client";
|
||||
tag: string;
|
||||
}
|
||||
|
||||
interface ActWindowActionDescription extends BaseActionDescription {
|
||||
type: "ir.actions.act_window";
|
||||
views: [false | number, string][];
|
||||
domain: false | string;
|
||||
res_id: number;
|
||||
res_model: string;
|
||||
context: Object | string;
|
||||
}
|
||||
|
||||
export type ActionDescription =
|
||||
| ClientActionDescription
|
||||
| ActWindowActionDescription;
|
||||
|
||||
export type ActionInfo = ClientActionInfo | ActWindowInfo;
|
||||
export type ActionStack = ActionInfo[];
|
||||
|
||||
Reference in New Issue
Block a user