summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/views
diff options
context:
space:
mode:
authorTejas Shahu <tsh@odoo.com>2018-09-05 10:35:06 +0000
committerGéry Debongnie <ged@odoo.com>2018-12-06 10:38:44 +0000
commit2a4c44bb4f0ef0d02c62991f588c20c0741616e2 (patch)
tree59102c28f00be51db7fb77d8901225d27a638776 /addons/web/static/src/js/views
parent458b49241a25b9571ab16ec51fce7e81dbbafc37 (diff)
[FIX] web: prevent crash in line chart
Before this commit: While user was opening first time line chart graph, at that time undefined label values were not being converted into undefined string due to misplace code. So it was giving traceback error After this commit: Code has been moved to proper place. Joint work with msh-odoo Issue-ID: 1882328 closes odoo/odoo#29306
Diffstat (limited to 'addons/web/static/src/js/views')
-rw-r--r--addons/web/static/src/js/views/graph/graph_renderer.js9
1 files changed, 4 insertions, 5 deletions
diff --git a/addons/web/static/src/js/views/graph/graph_renderer.js b/addons/web/static/src/js/views/graph/graph_renderer.js
index 0517e14c876..5deba9d69bd 100644
--- a/addons/web/static/src/js/views/graph/graph_renderer.js
+++ b/addons/web/static/src/js/views/graph/graph_renderer.js
@@ -332,8 +332,8 @@ return AbstractRenderer.extend({
var self = this;
// Remove Undefined of first GroupBy
- var graphData = _.filter(this.state.data, function(elem){
- return elem.labels[0] !== undefined;
+ var graphData = _.filter(this.state.data, function (elem) {
+ return elem.labels[0] !== undefined && elem.labels[0] !== _t("Undefined");
});
// undefined label value becomes a string 'Undefined' translated
@@ -386,10 +386,9 @@ return AbstractRenderer.extend({
var tick = 0;
var serie, tickLabel;
var identity = function (p) {return p;};
-
- for (var i = 0; i < this.state.data.length; i++) {
+ for (var i = 0; i < graphData.length; i++) {
if (graphData[i].labels[0] !== tickLabel) {
- tickLabel = this.state.data[i].labels[0];
+ tickLabel = graphData[i].labels[0];
ticksLabels.push(tickLabel);
tick++;
}