summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/view_graph.js
diff options
context:
space:
mode:
authorGéry Debongnie <ged@odoo.com>2015-03-11 13:40:01 +0100
committerGéry Debongnie <ged@odoo.com>2015-03-11 13:43:26 +0100
commitcda9221d7ceddbf84adcd04919e2810e2544d130 (patch)
treecfd9858d6d42b1ca30ba8d3a81ba889c44d955e9 /addons/web/static/src/js/view_graph.js
parentbe31cc299accac150968964274d2d121762994f7 (diff)
[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.
Diffstat (limited to 'addons/web/static/src/js/view_graph.js')
-rw-r--r--addons/web/static/src/js/view_graph.js9
1 files 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
}];