summaryrefslogtreecommitdiff
path: root/addons/website/static/src/js/backend/dashboard.js
diff options
context:
space:
mode:
authorVincent Schippefilt <vsc@odoo.com>2019-03-06 14:02:33 +0100
committerAaron Bohy <aab@odoo.com>2019-03-06 20:07:17 +0100
commit226a6a9e677b1ebded9240e181cc2ea83fa49d72 (patch)
treedb1caaa11b9905589031b10580db28a5486b2b20 /addons/website/static/src/js/backend/dashboard.js
parentc39033bc1cff578626b6925ed542cfc8f709e15c (diff)
[REF] website: adapt code after jQuery update
Part of task 1896658 Co-authored-by: Aaron Bohy <aab@odoo.com> Co-authored-by: Christophe Matthieu <chm@odoo.com> Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com> Co-authored-by: David Monjoie <dmo@odoo.com> Co-authored-by: Martin Geubelle <mge@odoo.com> Co-authored-by: svs-odoo <svs@odoo.com> Co-authored-by: Vincent Schippefilt <vsc@odoo.com>
Diffstat (limited to 'addons/website/static/src/js/backend/dashboard.js')
-rw-r--r--addons/website/static/src/js/backend/dashboard.js12
1 files changed, 7 insertions, 5 deletions
diff --git a/addons/website/static/src/js/backend/dashboard.js b/addons/website/static/src/js/backend/dashboard.js
index 0ec306c10f7..9f539cbe03e 100644
--- a/addons/website/static/src/js/backend/dashboard.js
+++ b/addons/website/static/src/js/backend/dashboard.js
@@ -42,7 +42,7 @@ var Dashboard = AbstractAction.extend({
willStart: function() {
var self = this;
- return $.when(ajax.loadLibs(this), this._super()).then(function() {
+ return Promise.all([ajax.loadLibs(this), this._super()]).then(function() {
return self.fetch_data();
}).then(function(){
var website = _.findWhere(self.websites, {selected: true});
@@ -63,20 +63,22 @@ var Dashboard = AbstractAction.extend({
*/
fetch_data: function() {
var self = this;
- return this._rpc({
+ var prom = this._rpc({
route: '/website/fetch_dashboard_data',
params: {
website_id: this.website_id || false,
date_from: this.date_from.year()+'-'+(this.date_from.month()+1)+'-'+this.date_from.date(),
date_to: this.date_to.year()+'-'+(this.date_to.month()+1)+'-'+this.date_to.date(),
},
- }).done(function(result) {
+ });
+ prom.then(function (result) {
self.data = result;
self.dashboards_data = result.dashboards;
self.currency_id = result.currency_id;
self.groups = result.groups;
self.websites = result.websites;
});
+ return prom;
},
on_link_analytics_settings: function(ev) {
@@ -242,7 +244,7 @@ var Dashboard = AbstractAction.extend({
}
var self = this;
- $.when(this.fetch_data()).then(function() {
+ Promise.resolve(this.fetch_data()).then(function () {
self.$('.o_website_dashboard').empty();
self.render_dashboards();
self.render_graphs();
@@ -253,7 +255,7 @@ var Dashboard = AbstractAction.extend({
on_website_button: function(website_id) {
var self = this;
this.website_id = website_id;
- $.when(this.fetch_data()).then(function() {
+ Promise.resolve(this.fetch_data()).then(function () {
self.$('.o_website_dashboard').empty();
self.render_dashboards();
self.render_graphs();