Skip to content
Open
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
220c8f5
[IMP] awesome_owl: add counter on page
djoewie Apr 24, 2026
ba0852d
[MOV] awesome_owl: move counter to own class
djoewie Apr 27, 2026
ac3da2c
[IMP] awesome_owl: add card
djoewie Apr 27, 2026
d201888
[IMP] awesome_owl: markup in display
djoewie Apr 27, 2026
bb195b5
[IMP] awesome_owl: add prop validation
djoewie Apr 27, 2026
e5cf19c
[IMP] awesome_owl: add total of counters
djoewie Apr 27, 2026
0233cdf
[IMP] awesome_owl: add visualisation of a todolist
djoewie Apr 27, 2026
43be439
[IMP] awesome_owl: mark completed items
djoewie Apr 27, 2026
4ccb0fc
[IMP] awesome_owl: make adding todo's possible
djoewie Apr 27, 2026
b1703e6
[IMP] awesome_owl: autofocus input field
djoewie Apr 27, 2026
3bfc874
[IMP] awesome_owl: toggeling todos
djoewie Apr 27, 2026
752c640
[CLN] awesome_owl: follow naming convention
djoewie Apr 27, 2026
c517440
[IMP] awesome_owl: make deleting todoitems possible
djoewie Apr 27, 2026
09e67bb
[IMP] awesome_owl: introduction to slots
djoewie Apr 27, 2026
206c82e
[IMP] awesome_owl: add option to hide card content
djoewie Apr 27, 2026
64a8839
[IMP] awesome_dashboard: a new layout
djoewie Apr 27, 2026
a758675
[IMP] awesome_dashboard: Add some buttons for quick navigation
djoewie Apr 27, 2026
73580ef
[IMP] awesome_dashboard: add dashboard items
djoewie Apr 28, 2026
f8efc82
[IMP] awesome_dashboard: add statistics on dashboard
djoewie Apr 28, 2026
949c551
[IMP] awesome_dashboard: caching the results
djoewie Apr 28, 2026
2affcf3
[IMP] awesome_dashboard: add pie-chart
djoewie Apr 28, 2026
cf78101
[CLN] awesome_owl: code convention camelcase for refs
djoewie Apr 28, 2026
286bd29
[CLN] awesome_dashboard: coding convention
djoewie Apr 28, 2026
1f1e971
[FIX] awesome_dashboard: piechart need to be destroyed before creatin…
djoewie Apr 28, 2026
dc7faf0
[IMP] awesome_dashboard: real life update
djoewie Apr 28, 2026
f127f24
[IMP] awesome_dashboard: lazy loading of module
djoewie Apr 28, 2026
416de43
[IMP] awesome_dashboard: make dashboard generic
djoewie Apr 28, 2026
0ede26b
[CLN] awesome_dashboard: improve readability of pie_chart
djoewie Apr 28, 2026
8b8558a
[IMP] awesome_dashboard: use a registry for the dashboard items
djoewie Apr 29, 2026
6dfb3d4
[IMP] awesome_dashboard: make dashboard items hideable
djoewie Apr 29, 2026
61531ba
[IMP] awesome_dashboard: add dutch translations
djoewie Apr 29, 2026
0dc5636
[CLN] estate: add a webcontroller
djoewie May 5, 2026
483de30
[MOV] estate: dashboard in its own file
djoewie May 5, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion awesome_dashboard/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@
'assets': {
'web.assets_backend': [
'awesome_dashboard/static/src/**/*',
('remove', 'awesome_dashboard/static/src/dashboard/**/*'),
],
'awesome_dashboard.dashboard': [
'awesome_dashboard/static/src/dashboard/**/*',
],
},
'license': 'AGPL-3'
'license': 'AGPL-3',
}
8 changes: 0 additions & 8 deletions awesome_dashboard/static/src/dashboard.js

This file was deleted.

8 changes: 0 additions & 8 deletions awesome_dashboard/static/src/dashboard.xml

This file was deleted.

35 changes: 35 additions & 0 deletions awesome_dashboard/static/src/dashboard/dashboard.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
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 { items } from "./dashboard_items";

class AwesomeDashboard extends Component {
static template = "awesome_dashboard.AwesomeDashboard";
static components = {Layout, DashboardItem};

setup() {
this.action = useService("action");
this.statistics = useState(useService("awesome_dashboard.statistics").loadStatistics);
this.items = items;
}

openCustomers() {
this.action.doAction("base.action_partner_form");
}

openLeads() {
this.action.doAction({
type: 'ir.actions.act_window',
target: 'current',
res_model: 'crm.lead',
views: [
[false, "list"],
[false, 'form'],
],
});
}
}

registry.category("lazy_components").add("AwesomeDashboard", AwesomeDashboard);
3 changes: 3 additions & 0 deletions awesome_dashboard/static/src/dashboard/dashboard.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.o_dashboard {
background-color: darkgrey;
}
20 changes: 20 additions & 0 deletions awesome_dashboard/static/src/dashboard/dashboard.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<templates xml:space="preserve">

<t t-name="awesome_dashboard.AwesomeDashboard">
<Layout display="{ controlPanel: {} }" className="'o_dashboard h-100'">
<t t-set-slot="layout-buttons">
<button type="button" class="btn btn-primary" t-on-click="openCustomers">Customers</button>
<button type="button" class="btn btn-primary" t-on-click="openLeads">Leads</button>
</t>
<t t-set-slot="default" t-if="statistics.isLoaded">
<t t-foreach="items" t-as="item" t-key="item.id">
<DashboardItem size="item.size || 1">
<t t-set="itemProp" t-value="item.props ? item.props(statistics) : {'data': statistics}"/>
<t t-component="item.Component" t-props="itemProp"/>
</DashboardItem>
</t>
</t>
</Layout>
</t>

</templates>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { Component } from "@odoo/owl";

export class DashboardItem extends Component {
static template = "awesome_dashboard.DashboardItem";
static props = {
size: {
type: Number,
optional: true,
},
slots: {
type: Object,
shape: {default: true},
}
};
static defaultProps = {
size: 1,
};
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<templates xml:space="preserve">

<t t-name="awesome_dashboard.DashboardItem">
<div class="card d-inline-block" t-att-style="'width: '+(18*props.size)+'rem;'">
<div class="card-body">
<p class="card-text">
<t t-slot="default"/>
</p>
</div>
</div>
</t>

</templates>
66 changes: 66 additions & 0 deletions awesome_dashboard/static/src/dashboard/dashboard_items.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import { NumberCard } from "./number_card/number_card";
import { PieChartCard } from "./pie_chart_card/pie_chart_card";

export let items = [
{
id: "average_quantity",
description: "Average amount of t-shirt",
Component: NumberCard,
// size and props are optionals
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for this comment everywhere

size: 3,
props: (data) => ({
title: "Average amount of t-shirt by order this month",
value: data.average_quantity
}),
},
{
id: "average_time",
description: "Average time for an order",
Component: NumberCard,
// size and props are optionals
props: (data) => ({
title: "Average time for an order to go from new to sent or canceled",
value: data.average_time
}),
},
{
id: "nb_new_orders",
description: "New orders this month",
Component: NumberCard,
// size and props are optionals
props: (data) => ({
title: "Number of new orders this month",
value: data.nb_new_orders
}),
}, {
id: "nb_cancelled_orders",
description: "Canceled orders this month",
Component: NumberCard,
// size and props are optionals
props: (data) => ({
title: "Number of canceled orders this month",
value: data.nb_cancelled_orders
}),
},
{
id: "total_amount",
description: "Smount of orders this month",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'Amount' 😄

Component: NumberCard,
// size and props are optionals
props: (data) => ({
title: "Total amount of orders this month",
value: data.total_amount
}),
},
{
id: "orders_by_size",
description: "Shirt orders by size",
Component: PieChartCard,
// size and props are optionals
props: (data) => ({
title: "Shirt orders by size",
values: data.orders_by_size
}),
},

];
13 changes: 13 additions & 0 deletions awesome_dashboard/static/src/dashboard/number_card/number_card.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { Component } from "@odoo/owl";

export class NumberCard extends Component {
static template = "awesome_dashboard.NumberCard";
static props = {
title: {
type: String,
},
value: {
type: Number,
}
};
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<templates xml:space="preserve">
<t t-name="awesome_dashboard.NumberCard">
<t t-out="props.title"/>
<div class="text-center text-success display-6 fw-bold"><t t-out="props.value"/></div>
</t>
</templates>
40 changes: 40 additions & 0 deletions awesome_dashboard/static/src/dashboard/pie_chart/pie_chart.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { Component, onMounted, onPatched, onWillStart, onWillUnmount, useRef } from "@odoo/owl";
import { loadJS } from "@web/core/assets";

export class PieChart extends Component {
static template = "awesome_dashboard.PieChart";
static props = {
data: {
type: Object,
}
}

setup() {
this.canvas = useRef("canvas");
onWillStart(async () => await loadJS("/web/static/lib/Chart/Chart.js"));
onMounted(() => this.renderChart());
onPatched(() => {
this.destroyChart();
this.renderChart();
});
onWillUnmount(() => this.destroyChart());
}

destroyChart() {
this.chart?.destroy();
}

renderChart() {
this.chart = new Chart(this.canvas.el, {
type: "pie",
data: {
labels: Object.keys(this.props.data),
datasets: [
{
data: Object.values(this.props.data),
},
],
}
});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<templates xml:space="preserve">

<t t-name="awesome_dashboard.PieChart">
<canvas t-ref="canvas"/>
</t>

</templates>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Component } from "@odoo/owl";
import { PieChart } from "../pie_chart/pie_chart";

export class PieChartCard extends Component {
static template = "awesome_dashboard.PieChartCard";
static components = {PieChart};
static props = {
title: {
type: String,
},
values: {
type: Object,
}
};
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<templates xml:space="preserve">
<t t-name="awesome_dashboard.PieChartCard">
<t t-out="props.title"/>
<PieChart data="props.values"/>
</t>
</templates>
23 changes: 23 additions & 0 deletions awesome_dashboard/static/src/dashboard/statistics_service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { rpc } from "@web/core/network/rpc";
import { registry } from "@web/core/registry";
import { reactive } from "@odoo/owl";


export const statisticsService = {
start() {
const statistics = reactive({isLoaded: false});

async function loadStatistics() {
Object.assign(statistics, await rpc("/awesome_dashboard/statistics"), {isLoaded: true});
}

setInterval(loadStatistics, 10 * 60 * 1000);
loadStatistics();

return {
loadStatistics: statistics,
};
},
};

registry.category("services").add("awesome_dashboard.statistics", statisticsService);
12 changes: 12 additions & 0 deletions awesome_dashboard/static/src/dashboard_loader.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { registry } from "@web/core/registry";
import { LazyComponent } from "@web/core/assets";
import { Component, xml } from "@odoo/owl";

export class DashBoardComponentLoader extends Component {
static components = {LazyComponent};
static template = xml`
<LazyComponent bundle="'awesome_dashboard.dashboard'" Component="'AwesomeDashboard'"/>
`;
}

registry.category("actions").add("awesome_dashboard.dashboard", DashBoardComponentLoader);
17 changes: 17 additions & 0 deletions awesome_owl/static/src/card/card.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { Component, useState } from "@odoo/owl";

export class Card extends Component {
static template = "awesome_owl.Card";
static props = {
'title': {type: String},
'slots': {type: Object, shape: {default: true}},
};

setup() {
this.state = useState({isOpen: true});
}

toggleOpen() {
this.state.isOpen = !this.state.isOpen;
}
}
13 changes: 13 additions & 0 deletions awesome_owl/static/src/card/card.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<templates xml:space="preserve">
<t t-name="awesome_owl.Card">
<div class="card d-inline-block m-2" style="width: 18rem;">
<div class="card-body">
<h5 class="card-title"><t t-out="props.title"/>
<button class="btn btn-primary" t-on-click="toggleOpen" type="button">Toggle</button></h5>
<p class="card-text" t-if="state.isOpen">
<t t-slot="default"/>
</p>
</div>
</div>
</t>
</templates>
19 changes: 19 additions & 0 deletions awesome_owl/static/src/counter/counter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { Component, useState } from "@odoo/owl";

export class Counter extends Component {
static template = "awesome_owl.Counter";
static props = {
"onChange": {type: Function, optional: true}
};

setup() {
this.state = useState({value: 0});
}

increment() {
this.state.value++;
if (this.props.onChange) {
this.props.onChange();
}
}
}
8 changes: 8 additions & 0 deletions awesome_owl/static/src/counter/counter.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<templates xml:space="preserve">
<t t-name="awesome_owl.Counter">
<div class="m-1 p-1 border d-inline-block">
<span class="me-1">Counter: <t t-esc="state.value"/></span>
<button class="btn btn-primary active" t-on-click="increment" type="button">Increment</button>
</div>
</t>
</templates>
Loading