[FIX] url handling of record id
bzr revid: chs@openerp.com-20111215142939-j2lz1irzoj10fy3v
This commit is contained in:
parent
2d1baf3dda
commit
af2e4fe2b5
|
@ -117,6 +117,18 @@ openerp.web.FormView = openerp.web.View.extend( /** @lends openerp.web.FormView#
|
||||||
}
|
}
|
||||||
this.has_been_loaded.resolve();
|
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 () {
|
do_show: function () {
|
||||||
var promise;
|
var promise;
|
||||||
if (this.dataset.index === null) {
|
if (this.dataset.index === null) {
|
||||||
|
|
|
@ -56,31 +56,38 @@ session.web.ActionManager = session.web.Widget.extend({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
do_load_state: function(state) {
|
do_load_state: function(state) {
|
||||||
|
var self = this,
|
||||||
|
action_loaded;
|
||||||
if (state.action_id) {
|
if (state.action_id) {
|
||||||
this.null_action();
|
var run_action = (!this.inner_viewmanager) || this.inner_viewmanager.action.id !== state.action_id;
|
||||||
this.do_action(state.action_id);
|
if (run_action) {
|
||||||
|
this.null_action();
|
||||||
|
action_loaded = this.do_action(state.action_id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (state.model && state.id) {
|
else if (state.model && state.id) {
|
||||||
// TODO implement it
|
// TODO implement it
|
||||||
//this.null_action();
|
//this.null_action();
|
||||||
// action = {}
|
//action = {res_model: state.model, res_id: state.id};
|
||||||
|
//action_loaded = this.do_action(action);
|
||||||
}
|
}
|
||||||
else if (state.client_action) {
|
else if (state.client_action) {
|
||||||
this.null_action();
|
this.null_action();
|
||||||
this.ir_actions_client(state.client_action);
|
this.ir_actions_client(state.client_action);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.inner_viewmanager) {
|
$.when(action_loaded || null).then(function() {
|
||||||
this.inner_viewmanager.do_load_state(state);
|
if (self.inner_viewmanager) {
|
||||||
}
|
self.inner_viewmanager.do_load_state(state);
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
do_action: function(action, on_close) {
|
do_action: function(action, on_close) {
|
||||||
if (_.isNumber(action)) {
|
if (_.isNumber(action)) {
|
||||||
var self = this;
|
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);
|
self.do_action(result.result, on_close);
|
||||||
});
|
});
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
if (!action.type) {
|
if (!action.type) {
|
||||||
console.error("No type for action", action);
|
console.error("No type for action", action);
|
||||||
|
@ -583,8 +590,13 @@ session.web.ViewManagerAction = session.web.ViewManager.extend(/** @lends oepner
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
do_load_state: function(state) {
|
do_load_state: function(state) {
|
||||||
var self = this;
|
var self = this,
|
||||||
$.when(this.on_mode_switch(state.view_type, true)).done(function() {
|
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);
|
self.views[self.active_view].controller.do_load_state(state);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue