odoo-tutorials/awesome_dashboard/static/src/dashboard/dashboard.js
2024-09-20 15:55:56 -10:00

38 lines
1.1 KiB
JavaScript

/** @odoo-module **/
import { Component, useState } from "@odoo/owl";
import { registry } from "@web/core/registry";
import { Layout } from "@web/search/layout";
import { useService } from "@web/core/utils/hooks"
import { DashboardItem } from "./dashboard_item/dashboard_item";
import { Piechart } from "./piechart/piechart";
class AwesomeDashboard extends Component {
static template = "awesome_dashboard.AwesomeDashboard";
static components = { Layout, DashboardItem, Piechart};
setup() {
this.display = {
controlPanel: {},
};
this.action = useService("action");
this.stats = useState(useService('awesome_dashboard.statistics'));
}
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']],
});
}
}
registry.category("lazy_components").add("AwesomeDashboard", AwesomeDashboard);