[FIX] web_tip: prevent useless calls to eval_tip
authorJulien Legros <jle@odoo.com>
Mon, 17 Nov 2014 15:48:10 +0000 (16:48 +0100)
committerJulien Legros <jle@odoo.com>
Tue, 18 Nov 2014 10:17:37 +0000 (11:17 +0100)
addons/web_tip/static/src/js/tip.js

index 6ad94dd..b010b29 100644 (file)
             var model = formView.model;
             var type = formView.datarecord.type ? formView.datarecord.type : null;
             var mode = 'form';
-            formView.on('view_content_has_changed', self, function() {
+            formView.on('view_content_has_changed', self, _.once(function() {
                 self.eval_tip(null, model, mode, type);
-            });
+            }));
             if ($('.oe_chatter').length > 0) {
-                instance.web.bus.on('chatter_messages_fetched', this, function() {
+                instance.web.bus.on('chatter_messages_fetched', this, _.once(function () {
                     self.eval_tip(null, model, mode, type);
-                });
+                }));
             } else {
                 self.eval_tip(null, model, mode, type);
             }