[FIX] Handle correctly webclient's show_application execution in web_analytics
authorvta vta@openerp.com <>
Thu, 10 Jan 2013 08:47:00 +0000 (09:47 +0100)
committervta vta@openerp.com <>
Thu, 10 Jan 2013 08:47:00 +0000 (09:47 +0100)
bzr revid: vta@openerp.com-20130110084700-curkkezb5333edai

addons/web_analytics/static/src/js/web_analytics.js

index f702a0d..75bcf29 100644 (file)
@@ -78,6 +78,7 @@ openerp.web_analytics = function(instance) {
             return instance.session.rpc("/web/webclient/version_info", {})
                 .done(function(res) {
                     _gaq.push(['_setCustomVar', 5, 'Version', res.server_version, 3]);
+                    _gaq.push(['_trackPageview']);
                     return;
                 });
         },
@@ -271,9 +272,10 @@ openerp.web_analytics = function(instance) {
             },
             show_application: function() {
                 var self = this;
-                instance.web_analytics.setupTracker(self).always(function() {
-                    self._super();
+                $.when(this.subscribe_deferred).then(function() {
+                    instance.web_analytics.setupTracker(self);
                 });
+                this._super();
             },
         });
     }