Skip to content

Commit b18ac0b

Browse files
committed
[ADD] awesome_dashboard: Added dashboard and linked buttons to actions
1 parent 0c521f5 commit b18ac0b

File tree

3 files changed

+32
-1
lines changed

3 files changed

+32
-1
lines changed

awesome_dashboard/static/src/dashboard.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,26 @@
22

33
import { Component } from "@odoo/owl";
44
import { registry } from "@web/core/registry";
5+
import { Layout } from "@web/search/layout";
6+
import { useService } from "@web/core/utils/hooks";
57

68
class AwesomeDashboard extends Component {
79
static template = "awesome_dashboard.AwesomeDashboard";
10+
11+
setup() {
12+
this.action = useService("action");
13+
//this.openSettings = this.openSettings.bind(this);
14+
}
15+
openCustomerList() {
16+
console.log('clicked');
17+
this.action.doAction("base.action_partner_form");
18+
}
19+
openLeadList() {
20+
console.log('clicked');
21+
this.action.doAction("crm.crm_lead_all_leads");
22+
}
23+
24+
static components = { Layout };
825
}
926

1027
registry.category("actions").add("awesome_dashboard.dashboard", AwesomeDashboard);
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.o_dashboard {
2+
background-color: gray;
3+
}

awesome_dashboard/static/src/dashboard.xml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,18 @@
22
<templates xml:space="preserve">
33

44
<t t-name="awesome_dashboard.AwesomeDashboard">
5-
hello dashboard
5+
<Layout className="'o_dashboard h-100'" display="{ controlPanel: {}}">
6+
<t t-set-slot="control-panel-create-button">
7+
<button type="button" class="btn btn-primary" t-on-click="openCustomerList">
8+
Customers
9+
</button>
10+
</t>
11+
<t t-set-slot="control-panel-always-buttons">
12+
<button type="button" class="btn btn-primary" t-on-click="openLeadList">
13+
Leads
14+
</button>
15+
</t>
16+
</Layout>
617
</t>
718

819
</templates>

0 commit comments

Comments
 (0)