From ef7fb887b79f99d94ffba520270fa46125b1fae1 Mon Sep 17 00:00:00 2001 From: Matt Marcha Date: Fri, 20 Sep 2024 10:38:30 -1000 Subject: [PATCH] ch2.2 Add some buttons for quick navigation --- awesome_dashboard/static/src/dashboard.js | 16 ++++++++++++++++ awesome_dashboard/static/src/dashboard.xml | 5 ++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/awesome_dashboard/static/src/dashboard.js b/awesome_dashboard/static/src/dashboard.js index 15d810a..6261803 100644 --- a/awesome_dashboard/static/src/dashboard.js +++ b/awesome_dashboard/static/src/dashboard.js @@ -3,6 +3,7 @@ import { Component } from "@odoo/owl"; import { registry } from "@web/core/registry"; import { Layout } from "@web/search/layout"; +import { useService } from "@web/core/utils/hooks" class AwesomeDashboard extends Component { static template = "awesome_dashboard.AwesomeDashboard"; @@ -12,6 +13,21 @@ class AwesomeDashboard extends Component { this.display = { controlPanel: {}, }; + + this.action = useService("action"); + } + + openCustomers() { + this.action.doAction("base.action_partner_form"); + } + + openLeads() { + this.action.doAction({ + type: 'ir.actions.act_window', + name: 'Leads', + res_model: 'crm.lead', + views: [[false, 'tree'],[false, 'form']], + }); } } diff --git a/awesome_dashboard/static/src/dashboard.xml b/awesome_dashboard/static/src/dashboard.xml index 5cc1f6d..65aab01 100644 --- a/awesome_dashboard/static/src/dashboard.xml +++ b/awesome_dashboard/static/src/dashboard.xml @@ -3,7 +3,10 @@ - + + + +