-
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
base: 19.0
Are you sure you want to change the base?
19.0 tutorial owl joemo #1250
Changes from 31 commits
220c8f5
ba0852d
ac3da2c
d201888
bb195b5
e5cf19c
0233cdf
43be439
4ccb0fc
b1703e6
3bfc874
752c640
c517440
09e67bb
206c82e
64a8839
a758675
73580ef
f8efc82
949c551
2affcf3
cf78101
286bd29
1f1e971
dc7faf0
f127f24
416de43
0ede26b
8b8558a
6dfb3d4
61531ba
0dc5636
483de30
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| import { Component, useRef, 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 { Dialog } from "@web/core/dialog/dialog"; | ||
| import { CheckBox } from "@web/core/checkbox/checkbox"; | ||
| import { _t } from "@web/core/l10n/translation"; | ||
|
|
||
| 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({ | ||
| disabled: 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(disabled) { | ||
| this.state.disabled = disabled; | ||
| } | ||
|
|
||
| openDialog() { | ||
| this.dialog = this.dialogService.add( | ||
| DashboardConfiguration, | ||
| {items: this.items, disabled: this.state.disabled, doneUpdating: this.updateDashboard.bind(this)}, | ||
| {}); | ||
| } | ||
| } | ||
|
|
||
| class DashboardConfiguration extends Component { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it should have its own file |
||
| static template = "awesome_dashboard.DashboardConfiguration"; | ||
| static components = {Dialog, CheckBox, _t}; | ||
| static props = ["close", "items", "disabled", "doneUpdating"]; | ||
|
|
||
|
|
||
| setup() { | ||
| this.options = useRef("options"); | ||
| this.items = useState(this.props.items.map(item => ({...item, disabled: this.props.disabled.includes(item.id)}))); | ||
| this.title = _t('Dashboard items configuration'); | ||
| } | ||
|
|
||
| updateDisabled(item, checked) { | ||
| item.disabled = !checked; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. see here |
||
| } | ||
|
|
||
| apply() { | ||
| const disabled = this.items.filter(item => item.disabled).map(item => item.id); | ||
| localStorage.setItem("awesome_dashboard_disabled", disabled); | ||
| this.props.doneUpdating(disabled); | ||
| this.props.close(); | ||
| } | ||
| } | ||
|
|
||
| registry.category("lazy_components").add("AwesomeDashboard", AwesomeDashboard); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| .o_dashboard { | ||
| background-color: darkgrey; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| <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.disabled.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> | ||
| <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> |
| 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> |
| 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 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No need for this comment everywhere |
||
| 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)); | ||
| 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> |
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.
I assume this was the disabled items on the menu. In that case I would name the variable disabledItems / disabledMenus or something.
disabledsounds like it's a boolean.