Skip to content

Commit 8c73677

Browse files
committed
[IMP] awesome_dashboard: added customers and leads button.
added customers and leads button in controlpanel layout. linked onclick in button function to call view action for customers and leads.
1 parent 12ab960 commit 8c73677

File tree

2 files changed

+40
-4
lines changed

2 files changed

+40
-4
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,40 @@
11
import { Component } from "@odoo/owl";
22
import { registry } from "@web/core/registry";
33
import { Layout } from "@web/search/layout";
4+
import { useService } from "@web/core/utils/hooks";
45

56
class AwesomeDashboard extends Component {
67
static template = "awesome_dashboard.AwesomeDashboard";
78
static components = { Layout }
9+
10+
setup() {
11+
this.action = useService("action");
12+
}
13+
14+
openCustomers() {
15+
this.action.doAction({
16+
type: "ir.actions.act_window",
17+
name: "Customers",
18+
res_model: "res.partner",
19+
views: [
20+
[false, "kanban"],
21+
[false, "form"],
22+
[false, "list"],
23+
],
24+
});
25+
}
26+
27+
openLeads() {
28+
this.action.doAction({
29+
type: "ir.actions.act_window",
30+
name: "Leads",
31+
res_model: "crm.lead",
32+
views: [
33+
[false, "list"],
34+
[false, "form"],
35+
],
36+
});
37+
}
838
}
939

1040
registry.category("actions").add("awesome_dashboard.dashboard", AwesomeDashboard);
Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
<?xml version="1.0" encoding="UTF-8" ?>
22
<templates xml:space="preserve">
3-
43
<t t-name="awesome_dashboard.AwesomeDashboard">
5-
<Layout display="{controlPanel: {}}" className="'o_dashboard h-100'">
6-
<h1>Hello World</h1>
4+
<Layout className="'o_dashboard h-100'" display="{ controlPanel: {} }">
5+
<t t-set-slot="control-panel-buttons">
6+
<button class="btn btn-primary me-2" t-on-click="openCustomers">
7+
Customers
8+
</button>
9+
<button class="btn btn-primary me-2" t-on-click="openLeads">
10+
Leads
11+
</button>
12+
</t>
13+
<h1 style="color: black;">Hello World</h1>
714
</Layout>
815
</t>
9-
1016
</templates>

0 commit comments

Comments
 (0)