From 51beb6a0adbdfbf7da44e94cb1e2b5045d09d84f Mon Sep 17 00:00:00 2001 From: Aaron Bohy Date: Thu, 20 Apr 2017 12:15:39 +0200 Subject: [FIX] web: JournalDashboardGraph: empty $el at rerendering The '_render' function of field widgets can be called several times in the widget's life cycle (each time its value changes). The JournalDashboardGraph appends a new 'svg' to its the $el at each rendering, so it must empty its $el at the beginning of each rendering. Before this fix, several graphs were displayed in the same kanban card in the Sales dashboard when, e.g., the user changed the color of the card. --- addons/web/static/src/js/fields/basic_fields.js | 1 + 1 file changed, 1 insertion(+) (limited to 'addons/web/static/src/js/fields') diff --git a/addons/web/static/src/js/fields/basic_fields.js b/addons/web/static/src/js/fields/basic_fields.js index 654d48db560..5a3bd699a7c 100644 --- a/addons/web/static/src/js/fields/basic_fields.js +++ b/addons/web/static/src/js/fields/basic_fields.js @@ -1701,6 +1701,7 @@ var JournalDashboardGraph = AbstractField.extend({ // note: the rendering of this widget is aynchronous as nvd3 does a // setTimeout(0) before executing the callback given to addGraph var self = this; + this.$el.empty(); this.chart = null; nv.addGraph(function () { self.$svg = self.$el.append(''); -- cgit v1.2.3