From cda9221d7ceddbf84adcd04919e2810e2544d130 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Debongnie?= Date: Wed, 11 Mar 2015 13:40:01 +0100 Subject: [PATCH] [FIX] web: prevent graph view from crashing (sometimes) if the graph view is set in bar mode, and does not have any groupby, then it tried to read some property from its viewmanager, which results in a crash. It is most likely the remnants of the old code, this commit correctly sets the string to the current measure. --- addons/web/static/src/js/view_graph.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/addons/web/static/src/js/view_graph.js b/addons/web/static/src/js/view_graph.js index 385f347e307..19da95b9273 100644 --- a/addons/web/static/src/js/view_graph.js +++ b/addons/web/static/src/js/view_graph.js @@ -1,8 +1,8 @@ /*--------------------------------------------------------- - * Odoo Pivot Table view + * Odoo Graph view *---------------------------------------------------------*/ -(function (a, b, c) { +(function () { 'use strict'; var instance = openerp, @@ -127,7 +127,7 @@ instance.web.GraphWidget = instance.web.Widget.extend({ this._super(parent); this.context = options.context; this.fields = options.fields; - this.fields.__count__ = _t("Quantity"); + this.fields.__count__ = {string: _t("Quantity"), type: "integer"}; this.model = new instance.web.Model(model, {group_by_no_leaf: true}); this.domain = options.domain || []; @@ -212,11 +212,12 @@ instance.web.GraphWidget = instance.web.Widget.extend({ // prepare data for bar chart var data, values, measure = this.fields[this.measure].string; + // zero groupbys if (this.groupbys.length === 0) { data = [{ values: [{ - x: this.ViewManager.title, + x: measure, y: this.data[0].value}], key: measure }];