Skip to content

Commit 972d66f

Browse files
committed
[IMP] awesome_dashboard: Add actions for opening customer view and leads in dashboard
1 parent 01c4faa commit 972d66f

File tree

4 files changed

+21
-2
lines changed

4 files changed

+21
-2
lines changed

Estate_account/models/account_move.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from odoo import models, fields
22

3+
34
class EstateMove(models.Model):
45
_inherit = "account.move"
56

awesome_dashboard/controllers/controllers.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,3 @@ def get_statistics(self):
3333
},
3434
'total_amount': random.randint(100, 1000)
3535
}
36-

awesome_dashboard/static/src/dashboard.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,33 @@
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 };
89

910
setup() {
11+
this.action = useService("action");
1012
this.display = {
1113
controlPanel: {},
1214
};
15+
16+
this.openCustomerView = () => {
17+
this.action.doAction("base.action_partner_form");
18+
}
19+
20+
this.openLeads = () => {
21+
this.action.doAction({
22+
type: "ir.actions.act_window",
23+
name: "All leads",
24+
res_model: "crm.lead",
25+
views: [
26+
[false, "list"],
27+
[false, "form"],
28+
],
29+
});
30+
}
1331
}
1432
}
1533

awesome_dashboard/static/src/dashboard.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
<t t-name="awesome_dashboard.AwesomeDashboard">
55
<Layout display="display" className="'o_dashboard h-100'">
66
<t t-set-slot="layout-buttons">
7-
Hello dashboard
7+
<button class="btn btn-primary" t-on-click="openCustomerView">Customers</button>
8+
<button class="btn btn-primary" t-on-click="openLeads">Leads</button>
89
</t>
910
some content
1011
</Layout>

0 commit comments

Comments
 (0)