Skip to content

Commit 8dd8fcc

Browse files
committed
[ADD] Section 12
1 parent fff2bf5 commit 8dd8fcc

File tree

14 files changed

+63
-22
lines changed

14 files changed

+63
-22
lines changed

awesome_dashboard/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
# -*- coding: utf-8 -*-
22

33
from . import controllers
4+
from . import models

awesome_dashboard/__manifest__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
'version': '0.1',
1717
'application': True,
1818
'installable': True,
19-
'depends': ['base', 'web', 'mail', 'crm'],
19+
'depends': ['base', 'web', 'mail', 'crm','sale'],
2020

2121
'data': [
2222
'views/views.xml',
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# -*- coding: utf-8 -*-
22

3-
from . import controllers
3+
from . import controllers
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import res_users_settings
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# models/res_users.py
2+
from odoo import models, fields
3+
4+
class ResUsersSettings(models.Model):
5+
_inherit = ["res.users.settings"]
6+
7+
disabled_items = fields.Char(
8+
string="Awesome Dashboard Disabled Items",
9+
)

awesome_dashboard/static/src/dashboard/config_dialog.js renamed to awesome_dashboard/static/src/dashboard/config_dialog/config_dialog.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
import { Component, useState } from "@odoo/owl";
22
import { Dialog } from "@web/core/dialog/dialog";
3-
import { items } from "./dashboard_items";
4-
import { registry } from "@web/core/registry";
53
import { CheckBox } from "@web/core/checkbox/checkbox";
6-
import { browser } from "@web/core/browser/browser";
74

85

96
export class ConfigDialog extends Component {
@@ -29,10 +26,6 @@ export class ConfigDialog extends Component {
2926
(item) => !item.enabled
3027
).map((item) => item.id);
3128

32-
browser.localStorage.setItem(
33-
"disabledItems", updatedDisabledItems,
34-
);
35-
3629
this.props.onUpdateConfigs(updatedDisabledItems);
3730
}
3831

File renamed without changes.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
.o_dashboard {
22
background-color: #f0f0f0;
33
}
4+
@media (max-width: 767.98px) {
5+
.o_dashboard .card {
6+
width: 100% !important; /* force full width */
7+
max-width: 100% !important;
8+
display: block !important; /* no inline-block on mobile */
9+
}
10+
}
411

awesome_dashboard/static/src/dashboard/dashboard.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { Component, onWillStart,useState } from "@odoo/owl";
1+
import { Component, useState } from "@odoo/owl";
22
import { registry } from "@web/core/registry";
33
import { Layout } from "@web/search/layout";
44
import { useService } from "@web/core/utils/hooks";
55
import { DashboardItem } from "./dashboard_item";
6-
import { ConfigDialog } from "./config_dialog";
7-
import { browser } from "@web/core/browser/browser";
6+
import { ConfigDialog } from "./config_dialog/config_dialog";
87
import { _t } from "@web/core/l10n/translation";
8+
import { user } from "@web/core/user";
99

1010
class AwesomeDashboard extends Component {
1111
static template = "awesome_dashboard.AwesomeDashboard";
@@ -15,9 +15,9 @@ class AwesomeDashboard extends Component {
1515
this.result = useState(useService("awesome_dashboard.statistics"));
1616
this.items = registry.category("awesome_dashboard").getAll();
1717
this.dialog = useService("dialog");
18-
// retreive disabled items
18+
1919
this.state = useState({
20-
disabledItems: browser.localStorage.getItem("disabledItems")?.split(",") || []
20+
disabledItems: user.settings.disabled_items || [],
2121
});
2222
}
2323
openCustomers() {
@@ -33,6 +33,7 @@ class AwesomeDashboard extends Component {
3333
// update the list of disabeled items
3434
updateConfigs(newDisabledItems) {
3535
this.state.disabledItems = newDisabledItems;
36+
user.setUserSettings("disabled_items", this.state.disabledItems)
3637
}
3738

3839
openLeads() {

awesome_dashboard/static/src/dashboard/dashboard_item.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export class DashboardItem extends Component {
1212
type: Object,
1313
},
1414
};
15-
get Width() {
15+
get itemWidth() {
1616
return 18*this.props.size
1717
}
1818
}

0 commit comments

Comments
 (0)