summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/fields/basic_fields.js
diff options
context:
space:
mode:
authorAaron Bohy <aab@odoo.com>2017-11-10 10:24:15 +0100
committerAaron Bohy <aab@odoo.com>2017-11-13 11:18:56 +0100
commit995610c065bf0242cb5023cfad2940234395739e (patch)
tree6615b650e25bd78f7470f633ee78fc11df5669f9 /addons/web/static/src/js/fields/basic_fields.js
parentf80d043af28988279a04d6b150eb617b374b3de2 (diff)
[FIX] web: JournalDashboardGraph widget crash
The JournalDashboardGraph requires nv, which is lazyloaded. Before this rev., a crash occurred when this widget was instantiated and destroyed before the loading of the lib was complete (because a function of the lib was called in destroy()). For instance, press F5 (to ensure that nv isn't already loaded), activate some throttling in the network tab, go to Accounting and as soon as the dashboard shows up, click on another menu. opw 781628
Diffstat (limited to 'addons/web/static/src/js/fields/basic_fields.js')
-rw-r--r--addons/web/static/src/js/fields/basic_fields.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/addons/web/static/src/js/fields/basic_fields.js b/addons/web/static/src/js/fields/basic_fields.js
index 817c76323d5..a4979848adb 100644
--- a/addons/web/static/src/js/fields/basic_fields.js
+++ b/addons/web/static/src/js/fields/basic_fields.js
@@ -2023,7 +2023,12 @@ var JournalDashboardGraph = AbstractField.extend({
return this._super.apply(this, arguments);
},
destroy: function () {
- nv.utils.offWindowResize(this._onResize);
+ if ('nv' in window) {
+ // if the widget is destroyed before the lazy loaded libs (nv) are
+ // actually loaded (i.e. after the widget has actually started),
+ // nv is undefined, but the handler isn't bound yet anyway
+ nv.utils.offWindowResize(this._onResize);
+ }
this._super.apply(this, arguments);
},