-
Notifications
You must be signed in to change notification settings - Fork 2.7k
WIMAR - Onboarding #1005
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?
WIMAR - Onboarding #1005
Changes from 19 commits
6e4093e
66a0801
82e151b
cd40928
9a9a4f3
9a90bd7
db9ded5
fe7da46
edaf208
1d073e0
4353811
cad2ef0
fb58afd
a9e718c
9081d57
f1448b2
b48fa58
bd25287
816de58
eefcaf9
2918ab0
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 |
|---|---|---|
| @@ -1,3 +1,2 @@ | ||
| # -*- coding: utf-8 -*- | ||
|
|
||
| from . import controllers | ||
| from . import models |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| # 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: 2025-10-31 14:36+0000\n" | ||
| "PO-Revision-Date: 2025-10-31 14:36+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_item.js:0 | ||
| msgid "Average amount of t-shirt by order this month" | ||
| msgstr "" | ||
|
|
||
| #. module: awesome_dashboard | ||
| #. odoo-javascript | ||
| #: code:addons/awesome_dashboard/static/src/dashboard/dashboard_item.js:0 | ||
| msgid "Average time for an order to go from 'new' to 'sent' or 'cancelled'" | ||
| msgstr "" | ||
|
|
||
| #. module: awesome_dashboard | ||
| #: model:ir.ui.menu,name:awesome_dashboard.menu_root | ||
| msgid "Awesome Dashboard" | ||
| msgstr "" | ||
|
|
||
| #. module: awesome_dashboard | ||
| #. odoo-javascript | ||
| #: code:addons/awesome_dashboard/static/src/dashboard/dashboard.xml:0 | ||
| msgid "Customers" | ||
| msgstr "" | ||
|
|
||
| #. module: awesome_dashboard | ||
| #: model:ir.actions.client,name:awesome_dashboard.dashboard | ||
| #: model:ir.ui.menu,name:awesome_dashboard.dashboard_menu | ||
| msgid "Dashboard" | ||
| msgstr "" | ||
|
|
||
| #. module: awesome_dashboard | ||
| #. odoo-javascript | ||
| #: code:addons/awesome_dashboard/static/src/dashboard/dashboard_configuration/dashboard_configuration.xml:0 | ||
| msgid "Done" | ||
| msgstr "" | ||
|
|
||
| #. module: awesome_dashboard | ||
| #. odoo-javascript | ||
| #: code:addons/awesome_dashboard/static/src/dashboard/dashboard.xml:0 | ||
| msgid "Leads" | ||
| msgstr "" | ||
|
|
||
| #. module: awesome_dashboard | ||
| #. odoo-javascript | ||
| #: code:addons/awesome_dashboard/static/src/dashboard/dashboard_item.js:0 | ||
| msgid "Number of cancelled orders this month" | ||
| msgstr "" | ||
|
|
||
| #. module: awesome_dashboard | ||
| #. odoo-javascript | ||
| #: code:addons/awesome_dashboard/static/src/dashboard/dashboard_item.js:0 | ||
| msgid "Number of new orders this month" | ||
| msgstr "" | ||
|
|
||
| #. module: awesome_dashboard | ||
| #. odoo-javascript | ||
| #: code:addons/awesome_dashboard/static/src/dashboard/dashboard_item.js:0 | ||
| msgid "Shirt orders by size" | ||
| msgstr "" | ||
|
|
||
| #. module: awesome_dashboard | ||
| #. odoo-javascript | ||
| #: code:addons/awesome_dashboard/static/src/dashboard/dashboard_item.js:0 | ||
| msgid "Total amount of new orders this month" | ||
| msgstr "" | ||
|
|
||
| #. module: awesome_dashboard | ||
| #. odoo-javascript | ||
| #: code:addons/awesome_dashboard/static/src/dashboard/dashboard_configuration/dashboard_configuration.xml:0 | ||
| msgid "Which cards do you wish to see ?" | ||
| msgstr "" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| # 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: 2025-10-31 14:33+0000\n" | ||
| "PO-Revision-Date: 2025-10-31 14:33+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_item.js:0 | ||
| msgid "Average amount of t-shirt by order this month" | ||
| msgstr "Moyenne du nombre de t-shirt par commande ce mois-ci" | ||
|
|
||
| #. module: awesome_dashboard | ||
| #. odoo-javascript | ||
| #: code:addons/awesome_dashboard/static/src/dashboard/dashboard_item.js:0 | ||
| msgid "Average time for an order to go from 'new' to 'sent' or 'cancelled'" | ||
| msgstr "" | ||
|
|
||
| #. module: awesome_dashboard | ||
| #: model:ir.ui.menu,name:awesome_dashboard.menu_root | ||
| msgid "Awesome Dashboard" | ||
| msgstr "" | ||
|
|
||
| #. module: awesome_dashboard | ||
| #. odoo-javascript | ||
| #: code:addons/awesome_dashboard/static/src/dashboard/dashboard.xml:0 | ||
| msgid "Customers" | ||
| msgstr "" | ||
|
|
||
| #. module: awesome_dashboard | ||
| #: model:ir.actions.client,name:awesome_dashboard.dashboard | ||
| #: model:ir.ui.menu,name:awesome_dashboard.dashboard_menu | ||
| msgid "Dashboard" | ||
| msgstr "" | ||
|
|
||
| #. module: awesome_dashboard | ||
| #. odoo-javascript | ||
| #: code:addons/awesome_dashboard/static/src/dashboard/dashboard_configuration/dashboard_configuration.xml:0 | ||
| msgid "Done" | ||
| msgstr "" | ||
|
|
||
| #. module: awesome_dashboard | ||
| #. odoo-javascript | ||
| #: code:addons/awesome_dashboard/static/src/dashboard/dashboard.xml:0 | ||
| msgid "Leads" | ||
| msgstr "" | ||
|
|
||
| #. module: awesome_dashboard | ||
| #. odoo-javascript | ||
| #: code:addons/awesome_dashboard/static/src/dashboard/dashboard_item.js:0 | ||
| msgid "Number of cancelled orders this month" | ||
| msgstr "" | ||
|
|
||
| #. module: awesome_dashboard | ||
| #. odoo-javascript | ||
| #: code:addons/awesome_dashboard/static/src/dashboard/dashboard_item.js:0 | ||
| msgid "Number of new orders this month" | ||
| msgstr "" | ||
|
|
||
| #. module: awesome_dashboard | ||
| #. odoo-javascript | ||
| #: code:addons/awesome_dashboard/static/src/dashboard/dashboard_item.js:0 | ||
| msgid "Shirt orders by size" | ||
| msgstr "" | ||
|
|
||
| #. module: awesome_dashboard | ||
| #. odoo-javascript | ||
| #: code:addons/awesome_dashboard/static/src/dashboard/dashboard_item.js:0 | ||
| msgid "Total amount of new orders this month" | ||
| msgstr "" | ||
|
|
||
| #. module: awesome_dashboard | ||
| #. odoo-javascript | ||
| #: code:addons/awesome_dashboard/static/src/dashboard/dashboard_configuration/dashboard_configuration.xml:0 | ||
| msgid "Which cards do you wish to see ?" | ||
| msgstr "" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| from . import res_users |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| from odoo import models, fields, api | ||
|
|
||
|
|
||
| class ResUsers(models.Model): | ||
| _inherit = "res.users" | ||
|
|
||
| average_quantity = fields.Boolean(default=True) | ||
| average_time = fields.Boolean(default=True) | ||
| nb_new_orders = fields.Boolean(default=True) | ||
| nb_cancelled_orders = fields.Boolean(default=True) | ||
| total_amount = fields.Boolean(default=True) | ||
| orders_by_size = fields.Boolean(default=True) | ||
|
|
||
| @api.model | ||
| def get_dashboard_config(self): | ||
| user = self.env.user | ||
| return { | ||
| 'average_quantity': user.average_quantity, | ||
| 'average_time': user.average_time, | ||
| 'nb_new_orders': user.nb_new_orders, | ||
| 'nb_cancelled_orders': user.nb_cancelled_orders, | ||
| 'total_amount': user.total_amount, | ||
| 'orders_by_size': user.orders_by_size, | ||
| } | ||
|
|
||
| @api.model | ||
| def set_dashboard_config(self, config): | ||
| user = self.env.user | ||
| user.write(config) | ||
| return True |
This file was deleted.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,93 @@ | ||||||||||||||||||||||
| import { Component, useState, onWillStart } 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"; | ||||||||||||||||||||||
| import { PieChart } from "./piechart/piechart"; | ||||||||||||||||||||||
| import { DashboardConfiguration } from "./dashboard_configuration/dashboard_configuration"; | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| class AwesomeDashboard extends Component { | ||||||||||||||||||||||
| static template = "awesome_dashboard.AwesomeDashboard"; | ||||||||||||||||||||||
| static components = { Layout, DashboardItem, PieChart }; | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| setup() { | ||||||||||||||||||||||
| this.action = useService("action"); | ||||||||||||||||||||||
| this.dialog = useService("dialog"); | ||||||||||||||||||||||
| this.orm = useService("orm"); | ||||||||||||||||||||||
| this.statisticsService = useState(useService("awesome_dashboard.statistics")); | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| this.allItems = registry.category("awesome_dashboard").getAll(); | ||||||||||||||||||||||
| this.state = useState({ | ||||||||||||||||||||||
| hiddenItems: [] | ||||||||||||||||||||||
| }); | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| onWillStart(async () => { | ||||||||||||||||||||||
| await this.loadHiddenItems(); | ||||||||||||||||||||||
| }); | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| get items() { | ||||||||||||||||||||||
| const visibleItems = {}; | ||||||||||||||||||||||
| Object.entries(this.allItems).forEach(([itemId, item]) => { | ||||||||||||||||||||||
| if (!this.state.hiddenItems.includes(item.backend_attribute)) { | ||||||||||||||||||||||
| visibleItems[itemId] = item; | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
| }); | ||||||||||||||||||||||
| return visibleItems; | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| async loadHiddenItems() { | ||||||||||||||||||||||
| try { | ||||||||||||||||||||||
| const config = await this.orm.call('res.users', 'get_dashboard_config', []); | ||||||||||||||||||||||
| const hiddenItems = []; | ||||||||||||||||||||||
| for (const [itemId, isVisible] of Object.entries(config)) { | ||||||||||||||||||||||
| if (!isVisible) { | ||||||||||||||||||||||
| hiddenItems.push(itemId); | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
| this.state.hiddenItems = hiddenItems; | ||||||||||||||||||||||
|
||||||||||||||||||||||
| const hiddenItems = []; | |
| for (const [itemId, isVisible] of Object.entries(config)) { | |
| if (!isVisible) { | |
| hiddenItems.push(itemId); | |
| } | |
| } | |
| this.state.hiddenItems = hiddenItems; | |
| this.state.hiddenItems = Object.entries(config) | |
| .filter(([itemId, isVisible]) => !isVisible) | |
| .map(([itemId]) => itemId); |
Outdated
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.
Same here for the reduce (but nothing mandatory)
| const config = {}; | |
| for (const item of Object.values(this.allItems)) { | |
| config[item.backend_attribute] = !hiddenItems.includes(item.backend_attribute); | |
| } | |
| const config = Object.values(this.allItems).reduce((acc, item) => { | |
| acc[item.backend_attribute] = !hiddenItems.includes(item.backend_attribute); | |
| return acc; | |
| }, {}); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| .o_dashboard { | ||
| background-color: gray; | ||
| } | ||
|
|
||
| .item_card { | ||
| background-color: white; | ||
| border: black solid 1px; | ||
| margin: 5px; | ||
| padding: 10px; | ||
| color: black; | ||
| } | ||
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| <?xml version="1.0" encoding="UTF-8" ?> | ||
| <templates xml:space="preserve"> | ||
|
|
||
| <t t-name="awesome_dashboard.AwesomeDashboard"> | ||
| <Layout display="{ controlPanel: {} }" className="'o_dashboard h-100'"> | ||
| <header> | ||
| <t t-set-slot="layout-buttons"> | ||
| <button t-on-click="openCustomers" type="button" class="btn btn-primary">Customers</button> | ||
| <button t-on-click="openLeads" type="button" class="btn btn-primary">Leads</button> | ||
| <button class="btn d-flex align-items-center gap-2" t-on-click="openConfiguration"><i class="fa fa-fw fa-gear"/></button> | ||
| </t> | ||
| </header> | ||
| <div class="d-flex flex-wrap"> | ||
| <t t-foreach="Object.entries(items)" t-as="entry" t-key="entry[0]"> | ||
| <t t-set="itemId" t-value="entry[0]"/> | ||
| <t t-set="item" t-value="entry[1]"/> | ||
| <DashboardItem size="item.size || 1"> | ||
| <t t-set="itemProp" t-value="item.props ? item.props(statisticsService.data) : {'data': statisticsService.data}"/> | ||
| <t t-component="item.Component" t-props="itemProp" /> | ||
| </DashboardItem> | ||
| </t> | ||
| </div> | ||
| </Layout> | ||
| </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.
In general, when you want to "migrate" from an array to a single value (here a dict),
.reduce(...)is the solution :)(just for your information)