[FIX] race condition between graph view loading and search request: View.start() should return a promise if it makes an async call, so caller (ViewManager in this case) knows when the graph view is ready for action

Also inherit from View

bzr revid: xmo@openerp.com-20110620143946-tv0qx84e0y06zxu7
This commit is contained in:
Xavier Morel
2011-06-20 16:39:46 +02:00
parent 2397a86d19
commit ec186dfb7d
3 changed files with 80 additions and 4 deletions
+2 -2
View File
@@ -14,7 +14,7 @@ var COLOR_PALETTE = [
QWeb.add_template('/base_graph/static/src/xml/base_graph.xml');
openerp.base.views.add('graph', 'openerp.base_graph.GraphView');
openerp.base_graph.GraphView = openerp.base.Controller.extend({
openerp.base_graph.GraphView = openerp.base.View.extend({
init: function(view_manager, session, element_id, dataset, view_id) {
this._super(session, element_id);
@@ -31,7 +31,7 @@ openerp.base_graph.GraphView = openerp.base.Controller.extend({
this.$element.hide();
},
start: function() {
this.rpc("/base_graph/graphview/load", {"model": this.model, "view_id": this.view_id}, this.on_loaded);
return this.rpc("/base_graph/graphview/load", {"model": this.model, "view_id": this.view_id}, this.on_loaded);
},
on_loaded: function(data) {
this.all_fields = data.all_fields;