summaryrefslogtreecommitdiff
path: root/addons/web/static/src
diff options
context:
space:
mode:
authorChristophe Simonis <chs@openerp.com>2011-12-15 15:29:39 +0100
committerChristophe Simonis <chs@openerp.com>2011-12-15 15:29:39 +0100
commitaf2e4fe2b54651904d72e84d681f16563c4de7a0 (patch)
tree67a0e47e748c27f09c620b4e9ec31c3e414d70c6 /addons/web/static/src
parent2d1baf3dda92c1e0700a901688e3c33bd647a0e0 (diff)
[FIX] url handling of record id
bzr revid: chs@openerp.com-20111215142939-j2lz1irzoj10fy3v
Diffstat (limited to 'addons/web/static/src')
-rw-r--r--addons/web/static/src/js/view_form.js12
-rw-r--r--addons/web/static/src/js/views.js32
2 files changed, 34 insertions, 10 deletions
diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js
index 607bf7b8a00..2e00e343b50 100644
--- a/addons/web/static/src/js/view_form.js
+++ b/addons/web/static/src/js/view_form.js
@@ -117,6 +117,18 @@ openerp.web.FormView = openerp.web.View.extend( /** @lends openerp.web.FormView#
}
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) {
diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js
index 36edec727a6..76082f3318b 100644
--- a/addons/web/static/src/js/views.js
+++ b/addons/web/static/src/js/views.js
@@ -56,31 +56,38 @@ session.web.ActionManager = session.web.Widget.extend({
}
},
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);
@@ -583,8 +590,13 @@ session.web.ViewManagerAction = session.web.ViewManager.extend(/** @lends oepner
}
},
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);
});
},