diff --git a/addons/website/__manifest__.py b/addons/website/__manifest__.py index aaba5cea675..5e62bf95162 100644 --- a/addons/website/__manifest__.py +++ b/addons/website/__manifest__.py @@ -17,18 +17,16 @@ Odoo Website CMS 'installable': True, 'data': [ 'data/website_data.xml', - 'data/web_planner_data.xml', 'security/website_security.xml', 'security/ir.model.access.csv', - 'views/website_templates.xml', 'views/website_navbar_templates.xml', 'views/snippets.xml', 'views/website_views.xml', 'views/res_config_views.xml', 'views/ir_actions_views.xml', - 'wizard/base_language_install_views.xml', + 'data/web_planner_data.xml', ], 'demo': [ 'data/website_demo.xml', diff --git a/addons/website/data/web_planner_data.xml b/addons/website/data/web_planner_data.xml index 0485cd3aac4..0cb1687dda8 100644 --- a/addons/website/data/web_planner_data.xml +++ b/addons/website/data/web_planner_data.xml @@ -709,7 +709,7 @@ Website Planner - + planner_website self - - Website - - website,static/description/icon.png - - - open diff --git a/addons/website/models/website.py b/addons/website/models/website.py index db918401eed..95a229cda71 100644 --- a/addons/website/models/website.py +++ b/addons/website/models/website.py @@ -601,6 +601,12 @@ class Website(models.Model): return urlparse.urljoin(cdn_url, uri) return uri + @api.model + def action_dashboard_redirect(self): + if self.env.user.has_group('base.group_system') or self.env.user.has_group('website.group_website_designer'): + return self.env.ref('website.backend_dashboard').read()[0] + return self.env.ref('website.action_website').read()[0] + class Menu(models.Model): diff --git a/addons/website/static/description/icon_admin.png b/addons/website/static/description/icon_admin.png deleted file mode 100644 index c3c37a0d645..00000000000 Binary files a/addons/website/static/description/icon_admin.png and /dev/null differ diff --git a/addons/website/static/src/js/website.backendDashboard.js b/addons/website/static/src/js/website.backendDashboard.js index 5caad853fcf..23e4c74a817 100644 --- a/addons/website/static/src/js/website.backendDashboard.js +++ b/addons/website/static/src/js/website.backendDashboard.js @@ -19,6 +19,7 @@ var Dashboard = Widget.extend(ControlPanelMixin, { template: "website.WebsiteDashboardMain", events: { 'click .js_link_analytics_settings': 'on_link_analytics_settings', + 'click .o_dashboard_action': 'on_dashboard_action_clicked', }, init: function(parent, context) { @@ -217,6 +218,23 @@ var Dashboard = Widget.extend(ControlPanelMixin, { this.update_cp(); }, + on_dashboard_action_clicked: function (ev) { + ev.preventDefault(); + var $action = $(ev.currentTarget); + var additional_context = {}; + if (this.date_range === 'week') { + additional_context = {'search_default_week': true} + } else if (this.date_range === 'month') { + additional_context = {'search_default_month': true} + } else if (this.date_range === 'year') { + additional_context = {'search_default_year': true} + } + this.do_action($action.attr('name'), { + additional_context: additional_context, + on_reverse_breadcrumb: this.on_reverse_breadcrumb + }); + }, + update_cp: function() { var self = this; if (!this.$searchview) { diff --git a/addons/website/static/src/less/website.backendDashboard.less b/addons/website/static/src/less/website.backendDashboard.less index 8c2c4737a3a..1e162f6c43b 100644 --- a/addons/website/static/src/less/website.backendDashboard.less +++ b/addons/website/static/src/less/website.backendDashboard.less @@ -128,6 +128,74 @@ } } + .o_dashboard_common { + .o_box { + display: flex; + flex-flow: row wrap; + justify-content: flex-start; + > .o_box_item { + @media (max-width: @screen-sm-min) { + flex: 1 1 200px; + display: block !important; + } + @media (min-width: @screen-sm-min) { + flex: 0 0 20%; + } + } + } + .o_inner_box { + padding-top: 10px; + text-align: center; + border: 1px solid @odoo-view-background-color; + height: 80px; + overflow: hidden; + text-overflow: ellipsis; + &.o_main { + background-color: @odoo-brand-optional; + &:hover { + background-color: darken(@odoo-brand-optional, 10%); + } + a { + color: white; + } + } + &.o_primary { + background-color: @odoo-brand-primary; + color: white; + &:hover { + background-color: darken(@odoo-brand-primary, 10%); + } + } + &.o_apps { + position: relative; + background-color: @odoo-brand-optional; + color: white; + .o_apps_hidden { + display: none; + &.o_apps_hide_panel { + position: absolute; + top: 0px; + right: 0px; + background: @brand-danger; + padding: 6px; + } + } + &:hover { + background-color: #45818E; + .o_apps_show { + display: none; + } + .o_apps_hidden { + display: block; + } + } + } + .o_highlight { + font-size: 27px; + } + } + } + .o_dashboard_visits { .o_demo_background { diff --git a/addons/website/static/src/xml/website.backend.xml b/addons/website/static/src/xml/website.backend.xml index 413c3d35631..992ffc5d821 100644 --- a/addons/website/static/src/xml/website.backend.xml +++ b/addons/website/static/src/xml/website.backend.xml @@ -8,6 +8,20 @@
+ +
+
+
+ + + diff --git a/addons/website/views/res_config_views.xml b/addons/website/views/res_config_views.xml index 5b05e220b1c..f923fa167a5 100644 --- a/addons/website/views/res_config_views.xml +++ b/addons/website/views/res_config_views.xml @@ -373,6 +373,10 @@ You can also edit the fields of the Extra Step page in eCommerce checkout."> - + diff --git a/addons/website/views/website_views.xml b/addons/website/views/website_views.xml index 9fbe8790a72..1b9b4c87fa5 100644 --- a/addons/website/views/website_views.xml +++ b/addons/website/views/website_views.xml @@ -2,11 +2,11 @@ - + groups="base.group_user" + web_icon="website,static/description/icon.png"/> @@ -124,11 +124,17 @@ backend_dashboard + + Website: Dashboard + + code + action = model.action_dashboard_redirect() + +