summaryrefslogtreecommitdiff
path: root/addons/website_crm/static
diff options
context:
space:
mode:
authorDamien Bouvy <dbo@odoo.com>2016-09-14 17:09:04 +0200
committerDamien Bouvy <dbo@odoo.com>2016-09-16 11:46:39 +0200
commit98e3d639a85843db178dd0c93d72fefdc875a585 (patch)
tree5cdf33904032ddae6fddc2b03cd2decfc60d716a /addons/website_crm/static
parent0ed6621e03517e88d2149572176fe1b0f9f0e3d7 (diff)
[IMP] website_crm: make the website admin graph acl-aware
This is linked to the previous commit. This commit adapts the widget extension and backend controller of the website admin dashboard to prevent a crash if the user does not have sales rights.
Diffstat (limited to 'addons/website_crm/static')
-rw-r--r--addons/website_crm/static/src/js/website_crm_backend.js14
-rw-r--r--addons/website_crm/static/src/xml/website_crm_dashboard.xml2
2 files changed, 9 insertions, 7 deletions
diff --git a/addons/website_crm/static/src/js/website_crm_backend.js b/addons/website_crm/static/src/js/website_crm_backend.js
index cc860c5c673..4a8bee4875c 100644
--- a/addons/website_crm/static/src/js/website_crm_backend.js
+++ b/addons/website_crm/static/src/js/website_crm_backend.js
@@ -16,7 +16,7 @@ WebsiteBackend.include({
this._super(parent, context);
this.dashboards_templates.push('website_crm.dashboard_leads');
- this.graphs.push('leads');
+ this.graphs.push({'name': 'leads', 'group': 'sale_salesman'});
this.leads_table = [];
this.lead_fields = [];
@@ -43,11 +43,13 @@ WebsiteBackend.include({
fetch_data: function() {
var self = this;
return this._super().then(function() {
- var leads = self.dashboards_data.leads.leads;
- if (leads && leads.length) {
- self.lead_fields = self.dashboards_data.leads.lead_fields;
- self.lead_field = Object.keys(self.lead_fields)[0];
- self.compute_percentages();
+ if (self.dashboards_data.leads) {
+ var leads = self.dashboards_data.leads.leads;
+ if (leads && leads.length) {
+ self.lead_fields = self.dashboards_data.leads.lead_fields;
+ self.lead_field = Object.keys(self.lead_fields)[0];
+ self.compute_percentages();
+ }
}
});
},
diff --git a/addons/website_crm/static/src/xml/website_crm_dashboard.xml b/addons/website_crm/static/src/xml/website_crm_dashboard.xml
index ff3814affd6..277ac0f4f17 100644
--- a/addons/website_crm/static/src/xml/website_crm_dashboard.xml
+++ b/addons/website_crm/static/src/xml/website_crm_dashboard.xml
@@ -2,7 +2,7 @@
<templates>
<t t-name="website_crm.dashboard_leads">
- <div class="row o_dashboard_leads">
+ <div t-if="widget.dashboards_data.leads" class="row o_dashboard_leads">
<div class="col-xs-12 o_box">
<div class="col-md-6 col-xs-12">
<h2>Leads Acquisition / <t t-esc="widget.date_range"></t></h2>