File tree Expand file tree Collapse file tree 2 files changed +40
-4
lines changed
awesome_dashboard/static/src Expand file tree Collapse file tree 2 files changed +40
-4
lines changed Original file line number Diff line number Diff line change 11import { Component } from "@odoo/owl" ;
22import { registry } from "@web/core/registry" ;
33import { Layout } from "@web/search/layout" ;
4+ import { useService } from "@web/core/utils/hooks" ;
45
56class 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
1040registry . category ( "actions" ) . add ( "awesome_dashboard.dashboard" , AwesomeDashboard ) ;
Original file line number Diff line number Diff line change 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 >
You can’t perform that action at this time.
0 commit comments