ch2.2 Add some buttons for quick navigation

This commit is contained in:
Matt Marcha 2024-09-20 10:38:30 -10:00
parent 8217053199
commit ef7fb887b7
2 changed files with 20 additions and 1 deletions

View file

@ -3,6 +3,7 @@
import { Component } from "@odoo/owl"; import { Component } from "@odoo/owl";
import { registry } from "@web/core/registry"; import { registry } from "@web/core/registry";
import { Layout } from "@web/search/layout"; import { Layout } from "@web/search/layout";
import { useService } from "@web/core/utils/hooks"
class AwesomeDashboard extends Component { class AwesomeDashboard extends Component {
static template = "awesome_dashboard.AwesomeDashboard"; static template = "awesome_dashboard.AwesomeDashboard";
@ -12,6 +13,21 @@ class AwesomeDashboard extends Component {
this.display = { this.display = {
controlPanel: {}, 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']],
});
} }
} }

View file

@ -3,7 +3,10 @@
<t t-name="awesome_dashboard.AwesomeDashboard"> <t t-name="awesome_dashboard.AwesomeDashboard">
<Layout display="display" className="'o_dashboard h-100'"> <Layout display="display" className="'o_dashboard h-100'">
<t t-set-slot="layout-buttons">
<button class="btn btn-primary" t-on-click="openCustomers">Customers</button>
<button class="btn btn-primary" t-on-click="openLeads">Leads</button>
</t>
</Layout> </Layout>
</t> </t>