File tree Expand file tree Collapse file tree 5 files changed +72
-1
lines changed Expand file tree Collapse file tree 5 files changed +72
-1
lines changed Original file line number Diff line number Diff line change 11import { Component } from "@odoo/owl" ;
22import { registry } from "@web/core/registry" ;
3+ import { Layout } from "@web/search/layout" ;
4+ import { useService } from "@web/core/utils/hooks" ;
5+ import { DashboardItem } from "./dashboard_item/dashboard_item" ;
36
47class AwesomeDashboard extends Component {
58 static template = "awesome_dashboard.AwesomeDashboard" ;
9+ static components = { Layout, DashboardItem } ;
10+
11+ setup ( ) {
12+ this . action = useService ( "action" ) ;
13+ this . display = {
14+ controlPanel : { } ,
15+ } ;
16+ }
17+
18+ openCustomerView ( ) {
19+ this . action . doAction ( "base.action_partner_form" ) ;
20+ }
21+
22+ openLeads ( ) {
23+ this . action . doAction ( {
24+ type : "ir.actions.act_window" ,
25+ name : "All leads" ,
26+ res_model : "crm.lead" ,
27+ views : [
28+ [ false , "list" ] ,
29+ [ false , "form" ] ,
30+ ] ,
31+ } ) ;
32+ }
633}
734
835registry . category ( "actions" ) . add ( "awesome_dashboard.dashboard" , AwesomeDashboard ) ;
Original file line number Diff line number Diff line change 22<templates xml : space =" preserve" >
33
44 <t t-name =" awesome_dashboard.AwesomeDashboard" >
5- hello dashboard
5+ <Layout display =" display" className =" 'o_dashboard h-100'" >
6+ <t t-set-slot =" layout-buttons" >
7+ <button class =" btn btn-primary" t-on-click =" openCustomerView" >Customers</button >
8+ <button class =" btn btn-primary" t-on-click =" openLeads" >Leads</button >
9+ </t >
10+ <div class =" d-flex flex-wrap" >
11+ <DashboardItem >
12+ some content
13+ </DashboardItem >
14+ <DashboardItem size =" 2" >
15+ I love milk
16+ </DashboardItem >
17+ <DashboardItem >
18+ some content
19+ </DashboardItem >
20+ </div >
21+ </Layout >
622 </t >
723
824</templates >
Original file line number Diff line number Diff line change 1+ import { Component } from "@odoo/owl" ;
2+
3+ export class DashboardItem extends Component {
4+ static template = "awesome_dashboard.DashboardItem"
5+ static props = {
6+ slots : {
7+ type : Object ,
8+ shape : {
9+ default : Object
10+ } ,
11+ } ,
12+ size : {
13+ type : Number ,
14+ default : 1 ,
15+ optional : true ,
16+ } ,
17+ } ;
18+ }
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2+ <templates xml : space =" preserve" >
3+ <t t-name =" awesome_dashboard.DashboardItem" >
4+ <div class =" card m-2 border-dark" t-attf-style =" width: {{18*props.size}}rem;" >
5+ <div class =" card-body" >
6+ <t t-slot =" default" />
7+ </div >
8+ </div >
9+ </t >
10+ </templates >
You can’t perform that action at this time.
0 commit comments