summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/fields/basic_fields.js
diff options
context:
space:
mode:
authorAaron Bohy <aab@odoo.com>2017-04-20 12:15:39 +0200
committerAaron Bohy <aab@odoo.com>2017-04-20 13:12:50 +0200
commit51beb6a0adbdfbf7da44e94cb1e2b5045d09d84f (patch)
tree3269693bf4a79cf7bded7c286b6cfe0d08f55bfc /addons/web/static/src/js/fields/basic_fields.js
parente61454f148583c90fca625de75fce85b5d0129c8 (diff)
[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.
Diffstat (limited to 'addons/web/static/src/js/fields/basic_fields.js')
-rw-r--r--addons/web/static/src/js/fields/basic_fields.js1
1 files changed, 1 insertions, 0 deletions
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('<svg>');