[FIX] fix the add to dashboard widget (web client)
authorGéry Debongnie <ged@odoo.com>
Fri, 30 May 2014 12:34:36 +0000 (14:34 +0200)
committerGéry Debongnie <ged@odoo.com>
Fri, 30 May 2014 12:34:36 +0000 (14:34 +0200)
The dashboard widget didn't work because it tried to look for its
parent view, but the searchview has been split in searchview and drawer.
This patch makes sure it looks for the data in the correct place.

addons/board/static/src/js/dashboard.js

index 05b2df0..7d58bda 100644 (file)
@@ -366,15 +366,13 @@ instance.board.AddToDashboard = instance.web.search.Input.extend({
     },
     add_dashboard: function(){
         var self = this;
-        var getParent = this.getParent();
-        var view_parent = this.getParent().getParent();
-        if (! view_parent.action || ! this.$el.find("select").val()) {
+        if (! this.view.view_manager.action || ! this.$el.find("select").val()) {
             this.do_warn("Can't find dashboard action");
             return;
         }
-        var data = getParent.build_search_data();
-        var context = new instance.web.CompoundContext(getParent.dataset.get_context() || []);
-        var domain = new instance.web.CompoundDomain(getParent.dataset.get_domain() || []);
+        var data = this.view.build_search_data();
+        var context = new instance.web.CompoundContext(this.view.dataset.get_context() || []);
+        var domain = new instance.web.CompoundDomain(this.view.dataset.get_domain() || []);
         _.each(data.contexts, context.add, context);
         _.each(data.domains, domain.add, domain);
 
@@ -394,10 +392,10 @@ instance.board.AddToDashboard = instance.web.search.Input.extend({
 
         this.rpc('/board/add_to_dashboard', {
             menu_id: this.$el.find("select").val(),
-            action_id: view_parent.action.id,
+            action_id: this.view.view_manager.action.id,
             context_to_save: c,
             domain: d,
-            view_mode: view_parent.active_view,
+            view_mode: this.view.view_manager.active_view,
             name: this.$el.find("input").val()
         }).done(function(r) {
             if (r === false) {