Skip to content
Snippets Groups Projects
Commit 5a006327 authored by Jeremy Kersten's avatar Jeremy Kersten
Browse files

[FIX] website_sale: fix tb on dashboard when no sale access


Before this commit, if you don't have the sale access right, when you arrive on
main website menu, the dashboard try to load some utms data and will fail with
a traceback.

Now we don't render utm graph it you don't have the sale access right

This commit closes odoo/odoo#54695

closes odoo/odoo#55801

X-original-commit: 8123bbc6
Signed-off-by: default avatarJérémy Kersten (jke) <jke@openerp.com>
parent 41f119d5
No related branches found
No related tags found
No related merge requests found
......@@ -35,13 +35,15 @@ class WebsiteSaleBackend(WebsiteBackend):
order_per_day_ratio=0, order_sold_ratio=0, order_convertion_pctg=0,
)
)
results['dashboards']['sales'] = sales_values
results['dashboards']['sales']['utm_graph'] = self.fetch_utm_data(datetime_from, datetime_to)
results['groups']['sale_salesman'] = request.env['res.users'].has_group('sales_team.group_sale_salesman')
if not results['groups']['sale_salesman']:
return results
results['dashboards']['sales']['utm_graph'] = self.fetch_utm_data(datetime_from, datetime_to)
# Product-based computation
sale_report_domain = [
('website_id', '=', current_website.id),
......
......@@ -27,7 +27,7 @@ WebsiteBackend.include({
render_graphs: function() {
this._super();
this.utmGraphData = this.dashboards_data.sales.utm_graph;
this._renderUtmGraph();
this.utmGraphData && this._renderUtmGraph();
},
//--------------------------------------------------------------------------
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment