summaryrefslogtreecommitdiff
path: root/addons/web/static/src
diff options
context:
space:
mode:
authorGéry Debongnie <ged@odoo.com>2016-12-08 10:11:24 +0100
committerGéry Debongnie <ged@odoo.com>2016-12-08 10:11:24 +0100
commit44c1fa7138daf41c08f9c823659496af19025aaa (patch)
treea53b73bae8c91a173cf689ee47eedfba4b927aa3 /addons/web/static/src
parent2ab85a0783206767c54913acb6294dc01df31c7a (diff)
[FIX] web: prevent crash in line chart with 1 record
Since commit 86252428846607cd5f4b18c, the graph view crashed when displaying a line chart with only one record. The reason is that the method display_line can return undefined (if no line chart can be displayed). In that case, there is no reasy to try to display its tooltip. This commit simply protect against the case where it is undefined.
Diffstat (limited to 'addons/web/static/src')
-rw-r--r--addons/web/static/src/js/views/graph_widget.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/addons/web/static/src/js/views/graph_widget.js b/addons/web/static/src/js/views/graph_widget.js
index b2cd726c95c..6b9e8459b78 100644
--- a/addons/web/static/src/js/views/graph_widget.js
+++ b/addons/web/static/src/js/views/graph_widget.js
@@ -99,7 +99,9 @@ return Widget.extend({
}));
} else {
var chart = this['display_' + this.mode]();
- chart.tooltip.chartContainer(this.$el[0]);
+ if (chart) {
+ chart.tooltip.chartContainer(this.$el[0]);
+ }
}
},
display_bar: function () {