}
this.has_been_loaded.resolve();
},
+
+ do_load_state: function(state) {
+ if (state.id && this.datarecord.id != state.id) {
+ var idx = this.dataset.get_id_index(state.id);
+ if (idx === null) {
+ this.dataset.ids.push(state.id)
+ this.dataset.index = this.dataset.ids.length - 1;
+ }
+ this.do_show();
+ }
+ },
+
do_show: function () {
var promise;
if (this.dataset.index === null) {
}
},
do_load_state: function(state) {
+ var self = this,
+ action_loaded;
if (state.action_id) {
- this.null_action();
- this.do_action(state.action_id);
+ var run_action = (!this.inner_viewmanager) || this.inner_viewmanager.action.id !== state.action_id;
+ if (run_action) {
+ this.null_action();
+ action_loaded = this.do_action(state.action_id);
+ }
}
else if (state.model && state.id) {
// TODO implement it
//this.null_action();
- // action = {}
+ //action = {res_model: state.model, res_id: state.id};
+ //action_loaded = this.do_action(action);
}
else if (state.client_action) {
this.null_action();
this.ir_actions_client(state.client_action);
}
- if (this.inner_viewmanager) {
- this.inner_viewmanager.do_load_state(state);
- }
+ $.when(action_loaded || null).then(function() {
+ if (self.inner_viewmanager) {
+ self.inner_viewmanager.do_load_state(state);
+ }
+ });
},
do_action: function(action, on_close) {
if (_.isNumber(action)) {
var self = this;
- self.rpc("/web/action/load", { action_id: action }, function(result) {
+ return self.rpc("/web/action/load", { action_id: action }, function(result) {
self.do_action(result.result, on_close);
});
- return;
}
if (!action.type) {
console.error("No type for action", action);
}
},
do_load_state: function(state) {
- var self = this;
- $.when(this.on_mode_switch(state.view_type, true)).done(function() {
+ var self = this,
+ defs = [];
+ if (state.view_type && state.view_type !== this.active_view) {
+ defs.push(this.on_mode_switch(state.view_type, true));
+ }
+
+ $.when(defs).then(function() {
self.views[self.active_view].controller.do_load_state(state);
});
},