-
Notifications
You must be signed in to change notification settings - Fork 3.1k
19.0 tutorial owl joemo #1250
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
djoewie
wants to merge
33
commits into
odoo:19.0
Choose a base branch
from
odoo-dev:19.0-tutorial-owl-joemo
base: 19.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
19.0 tutorial owl joemo #1250
Changes from all 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 ba0852d
[MOV] awesome_owl: move counter to own class
djoewie ac3da2c
[IMP] awesome_owl: add card
djoewie d201888
[IMP] awesome_owl: markup in display
djoewie bb195b5
[IMP] awesome_owl: add prop validation
djoewie e5cf19c
[IMP] awesome_owl: add total of counters
djoewie 0233cdf
[IMP] awesome_owl: add visualisation of a todolist
djoewie 43be439
[IMP] awesome_owl: mark completed items
djoewie 4ccb0fc
[IMP] awesome_owl: make adding todo's possible
djoewie b1703e6
[IMP] awesome_owl: autofocus input field
djoewie 3bfc874
[IMP] awesome_owl: toggeling todos
djoewie 752c640
[CLN] awesome_owl: follow naming convention
djoewie c517440
[IMP] awesome_owl: make deleting todoitems possible
djoewie 09e67bb
[IMP] awesome_owl: introduction to slots
djoewie 206c82e
[IMP] awesome_owl: add option to hide card content
djoewie 64a8839
[IMP] awesome_dashboard: a new layout
djoewie a758675
[IMP] awesome_dashboard: Add some buttons for quick navigation
djoewie 73580ef
[IMP] awesome_dashboard: add dashboard items
djoewie f8efc82
[IMP] awesome_dashboard: add statistics on dashboard
djoewie 949c551
[IMP] awesome_dashboard: caching the results
djoewie 2affcf3
[IMP] awesome_dashboard: add pie-chart
djoewie cf78101
[CLN] awesome_owl: code convention camelcase for refs
djoewie 286bd29
[CLN] awesome_dashboard: coding convention
djoewie 1f1e971
[FIX] awesome_dashboard: piechart need to be destroyed before creatin…
djoewie dc7faf0
[IMP] awesome_dashboard: real life update
djoewie f127f24
[IMP] awesome_dashboard: lazy loading of module
djoewie 416de43
[IMP] awesome_dashboard: make dashboard generic
djoewie 0ede26b
[CLN] awesome_dashboard: improve readability of pie_chart
djoewie 8b8558a
[IMP] awesome_dashboard: use a registry for the dashboard items
djoewie 6dfb3d4
[IMP] awesome_dashboard: make dashboard items hideable
djoewie 61531ba
[IMP] awesome_dashboard: add dutch translations
djoewie 0dc5636
[CLN] estate: add a webcontroller
djoewie 483de30
[MOV] estate: dashboard in its own file
djoewie File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,117 @@ | ||
| # Translation of Odoo Server. | ||
| # This file contains the translation of the following modules: | ||
| # * awesome_dashboard | ||
| # | ||
| msgid "" | ||
| msgstr "" | ||
| "Project-Id-Version: Odoo Server 19.0+e\n" | ||
| "Report-Msgid-Bugs-To: \n" | ||
| "POT-Creation-Date: 2026-04-29 12:41+0000\n" | ||
| "PO-Revision-Date: 2026-04-29 12:41+0000\n" | ||
| "Last-Translator: \n" | ||
| "Language-Team: \n" | ||
| "MIME-Version: 1.0\n" | ||
| "Content-Type: text/plain; charset=UTF-8\n" | ||
| "Content-Transfer-Encoding: \n" | ||
| "Plural-Forms: \n" | ||
|
|
||
| #. module: awesome_dashboard | ||
| #. odoo-javascript | ||
| #: code:addons/awesome_dashboard/static/src/dashboard/dashboard_items.js:0 | ||
| msgid "Amount of orders this month" | ||
| msgstr "Aantal orders per maand" | ||
|
|
||
| #. module: awesome_dashboard | ||
| #. odoo-javascript | ||
| #: code:addons/awesome_dashboard/static/src/dashboard/dashboard.xml:0 | ||
| msgid "Apply" | ||
| msgstr "Opslaan" | ||
|
|
||
| #. module: awesome_dashboard | ||
| #. odoo-javascript | ||
| #: code:addons/awesome_dashboard/static/src/dashboard/dashboard_items.js:0 | ||
| msgid "Average amount of t-shirt" | ||
| msgstr "Gemiddeld aantal t-shirt" | ||
|
|
||
| #. module: awesome_dashboard | ||
| #. odoo-javascript | ||
| #: code:addons/awesome_dashboard/static/src/dashboard/dashboard_items.js:0 | ||
| msgid "Average amount of t-shirt by order this month" | ||
| msgstr "Gemiddeld aantal t-shirts per bestelling deze maand" | ||
|
|
||
| #. module: awesome_dashboard | ||
| #. odoo-javascript | ||
| #: code:addons/awesome_dashboard/static/src/dashboard/dashboard_items.js:0 | ||
| msgid "Average time for an order" | ||
| msgstr "Gemiddelde tijd voor een order" | ||
|
|
||
| #. module: awesome_dashboard | ||
| #. odoo-javascript | ||
| #: code:addons/awesome_dashboard/static/src/dashboard/dashboard_items.js:0 | ||
| msgid "Average time for an order to go from new to sent or canceled" | ||
| msgstr "Gemiddelde tijd voor een bestelling om van nieuw naar verzonden of geannuleerd te gaan" | ||
|
|
||
| #. module: awesome_dashboard | ||
| #: model:ir.ui.menu,name:awesome_dashboard.menu_root | ||
| msgid "Awesome Dashboard" | ||
| msgstr "Magisch overzicht" | ||
|
|
||
| #. module: awesome_dashboard | ||
| #. odoo-javascript | ||
| #: code:addons/awesome_dashboard/static/src/dashboard/dashboard_items.js:0 | ||
| msgid "Canceled orders this month" | ||
| msgstr "Geannulleerde orders deze maand" | ||
|
|
||
| #. module: awesome_dashboard | ||
| #. odoo-javascript | ||
| #: code:addons/awesome_dashboard/static/src/dashboard/dashboard.xml:0 | ||
| msgid "Customers" | ||
| msgstr "Klanten" | ||
|
|
||
| #. module: awesome_dashboard | ||
| #: model:ir.actions.client,name:awesome_dashboard.dashboard | ||
| #: model:ir.ui.menu,name:awesome_dashboard.dashboard_menu | ||
| msgid "Dashboard" | ||
| msgstr "Overzicht" | ||
|
|
||
| #. module: awesome_dashboard | ||
| #. odoo-javascript | ||
| #: code:addons/awesome_dashboard/static/src/dashboard/dashboard.js:0 | ||
| msgid "Dashboard items configuration" | ||
| msgstr "Dashboard items configureren" | ||
|
|
||
| #. module: awesome_dashboard | ||
| #. odoo-javascript | ||
| #: code:addons/awesome_dashboard/static/src/dashboard/dashboard.xml:0 | ||
| msgid "Leads" | ||
| msgstr "Prospecten" | ||
|
|
||
| #. module: awesome_dashboard | ||
| #. odoo-javascript | ||
| #: code:addons/awesome_dashboard/static/src/dashboard/dashboard_items.js:0 | ||
| msgid "New orders this month" | ||
| msgstr "Nieuwe bestellingen deze maand" | ||
|
|
||
| #. module: awesome_dashboard | ||
| #. odoo-javascript | ||
| #: code:addons/awesome_dashboard/static/src/dashboard/dashboard_items.js:0 | ||
| msgid "Number of canceled orders this month" | ||
| msgstr "Aantal geannuleerde bestellingen deze maand" | ||
|
|
||
| #. module: awesome_dashboard | ||
| #. odoo-javascript | ||
| #: code:addons/awesome_dashboard/static/src/dashboard/dashboard_items.js:0 | ||
| msgid "Number of new orders this month" | ||
| msgstr "Aantal nieuwe orders deze maand" | ||
|
|
||
| #. module: awesome_dashboard | ||
| #. odoo-javascript | ||
| #: code:addons/awesome_dashboard/static/src/dashboard/dashboard_items.js:0 | ||
| msgid "Shirt orders by size" | ||
| msgstr "Shirt bestellingen per maat" | ||
|
|
||
| #. module: awesome_dashboard | ||
| #. odoo-javascript | ||
| #: code:addons/awesome_dashboard/static/src/dashboard/dashboard_items.js:0 | ||
| msgid "Total amount of orders this month" | ||
| msgstr "Totaal aantal bestellingen deze maand" |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| 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 { DashboardConfiguration } from "./dashboard_configuration/dashboard_configuration"; | ||
|
|
||
| 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.dialogService = useService("dialog"); | ||
| this.items = registry.category("awesome_dashboard").getAll(); | ||
| this.state = useState({ | ||
| disabledItems: localStorage.getItem("awesome_dashboard_disabled")?.split(',') || [] | ||
| }); | ||
| } | ||
|
|
||
| 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'],], | ||
| }); | ||
| } | ||
|
|
||
| updateDashboard(disabledItems) { | ||
| this.state.disabledItems = disabledItems; | ||
| } | ||
|
|
||
| openDialog() { | ||
| this.dialog = this.dialogService.add( | ||
| DashboardConfiguration, | ||
| {items: this.items, disabledItems: this.state.disabledItems, doneUpdating: this.updateDashboard.bind(this)}, | ||
| {}); | ||
| } | ||
| } | ||
|
|
||
| registry.category("lazy_components").add("AwesomeDashboard", AwesomeDashboard); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| .o_dashboard { | ||
| background-color: darkgrey; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| <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="control-panel-additional-actions"> | ||
| <button t-on-click="openDialog" class="btn p-0"><i class="fa fa-fw fa-cog"/></button> | ||
| </t> | ||
| <t t-set-slot="default" t-if="statistics.isLoaded"> | ||
| <t t-foreach="items" t-as="item" t-key="item.id"> | ||
| <DashboardItem t-if="!state.disabledItems.includes(item.id)" 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> |
28 changes: 28 additions & 0 deletions
28
awesome_dashboard/static/src/dashboard/dashboard_configuration/dashboard_configuration.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| import { Component, useRef, useState } from "@odoo/owl"; | ||
| import { Dialog } from "@web/core/dialog/dialog"; | ||
| import { CheckBox } from "@web/core/checkbox/checkbox"; | ||
| import { _t } from "@web/core/l10n/translation"; | ||
|
|
||
| export class DashboardConfiguration extends Component { | ||
| static template = "awesome_dashboard.DashboardConfiguration"; | ||
| static components = {Dialog, CheckBox, _t}; | ||
| static props = ["close", "items", "disabledItems", "doneUpdating"]; | ||
|
|
||
|
|
||
| setup() { | ||
| this.options = useRef("options"); | ||
| this.items = useState(this.props.items.map(item => ({...item, disabled: this.props.disabledItems.includes(item.id)}))); | ||
| this.title = _t('Dashboard items configuration'); | ||
| } | ||
|
|
||
| updateDisabled(item, checked) { | ||
| item.disabled = !checked; | ||
| } | ||
|
|
||
| apply() { | ||
| const disabledItems = this.items.filter(item => item.disabled).map(item => item.id); | ||
| localStorage.setItem("awesome_dashboard_disabled", disabledItems); | ||
| this.props.doneUpdating(disabledItems); | ||
| this.props.close(); | ||
| } | ||
| } |
14 changes: 14 additions & 0 deletions
14
awesome_dashboard/static/src/dashboard/dashboard_configuration/dashboard_configuration.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| <templates xml:space="preserve"> | ||
| <t t-name="awesome_dashboard.DashboardConfiguration"> | ||
| <Dialog title="title"> | ||
| <form t-ref="options"> | ||
| <t t-foreach="items" t-as="item" t-key="item.id"> | ||
| <CheckBox value="!item.disabled" onChange="state => updateDisabled(item,state)"><t t-out="item.description"/></CheckBox> | ||
| </t> | ||
| </form> | ||
| <t t-set-slot="footer"> | ||
| <button type="button" class="btn btn-primary" t-on-click="apply">Apply</button> | ||
| </t> | ||
| </Dialog> | ||
| </t> | ||
| </templates> |
18 changes: 18 additions & 0 deletions
18
awesome_dashboard/static/src/dashboard/dashboard_item/dashboard_item.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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, | ||
| }; | ||
| } |
13 changes: 13 additions & 0 deletions
13
awesome_dashboard/static/src/dashboard/dashboard_item/dashboard_item.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| import { NumberCard } from "./number_card/number_card"; | ||
| import { PieChartCard } from "./pie_chart_card/pie_chart_card"; | ||
| import { registry } from "@web/core/registry"; | ||
| import { _t } from "@web/core/l10n/translation"; | ||
|
|
||
| export let items = [ | ||
| { | ||
| id: "average_quantity", | ||
| description: _t("Average amount of t-shirt"), | ||
| Component: NumberCard, | ||
| // size and props are optionals | ||
| size: 3, | ||
| props: (data) => ({ | ||
| title: _t("Average amount of t-shirt by order this month"), | ||
| value: data.average_quantity | ||
| }), | ||
| }, | ||
| { | ||
| id: "average_time", | ||
| description: _t("Average time for an order"), | ||
| Component: NumberCard, | ||
| // size and props are optionals | ||
| props: (data) => ({ | ||
| title: _t("Average time for an order to go from new to sent or canceled"), | ||
| value: data.average_time | ||
| }), | ||
| }, | ||
| { | ||
| id: "nb_new_orders", | ||
| description: _t("New orders this month"), | ||
| Component: NumberCard, | ||
| // size and props are optionals | ||
| props: (data) => ({ | ||
| title: _t("Number of new orders this month"), | ||
| value: data.nb_new_orders | ||
| }), | ||
| }, { | ||
| id: "nb_cancelled_orders", | ||
| description: _t("Canceled orders this month"), | ||
| Component: NumberCard, | ||
| // size and props are optionals | ||
| props: (data) => ({ | ||
| title: _t("Number of canceled orders this month"), | ||
| value: data.nb_cancelled_orders | ||
| }), | ||
| }, | ||
| { | ||
| id: "total_amount", | ||
| description: _t("Amount of orders this month"), | ||
| Component: NumberCard, | ||
| // size and props are optionals | ||
| props: (data) => ({ | ||
| title: _t("Total amount of orders this month"), | ||
| value: data.total_amount | ||
| }), | ||
| }, | ||
| { | ||
| id: "orders_by_size", | ||
| description: _t("Shirt orders by size"), | ||
| Component: PieChartCard, | ||
| // size and props are optionals | ||
| props: (data) => ({ | ||
| title: _t("Shirt orders by size"), | ||
| values: data.orders_by_size | ||
| }), | ||
| }, | ||
|
|
||
| ]; | ||
|
|
||
| items.forEach(item => registry.category("awesome_dashboard").add(item.id, item)); | ||
13 changes: 13 additions & 0 deletions
13
awesome_dashboard/static/src/dashboard/number_card/number_card.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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, | ||
| } | ||
| }; | ||
| } |
6 changes: 6 additions & 0 deletions
6
awesome_dashboard/static/src/dashboard/number_card/number_card.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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