[ADD] special case: creating a record from list goes back to page view, not list view
bzr revid: xmo@openerp.com-20111207153101-kzpolvmvmxnjl20m
This commit is contained in:
@@ -356,8 +356,8 @@ openerp.web.FormView = openerp.web.View.extend( /** @lends openerp.web.FormView#
|
||||
},
|
||||
on_button_save: function() {
|
||||
var self = this;
|
||||
return this.do_save().then(function() {
|
||||
self.do_prev_view();
|
||||
return this.do_save().then(function(result) {
|
||||
self.do_prev_view(result.created);
|
||||
});
|
||||
},
|
||||
on_button_cancel: function() {
|
||||
@@ -433,6 +433,7 @@ openerp.web.FormView = openerp.web.View.extend( /** @lends openerp.web.FormView#
|
||||
if (success) {
|
||||
success();
|
||||
}
|
||||
return $.Deferred().resolve({}).promise();
|
||||
} else {
|
||||
openerp.log("FormView(", self, ") : About to save", values);
|
||||
return self.dataset.write(self.datarecord.id, values, {}).pipe(function(r) {
|
||||
|
||||
@@ -300,10 +300,23 @@ session.web.ViewManager = session.web.Widget.extend(/** @lends session.web.View
|
||||
});
|
||||
return view_promise;
|
||||
},
|
||||
on_prev_view: function () {
|
||||
this.views_history.pop();
|
||||
/**
|
||||
* Returns to the view preceding the caller view in this manager's
|
||||
* navigation history (the navigation history is appended to via
|
||||
* on_mode_switch)
|
||||
*
|
||||
* @param {Boolean} [created=false] returning from a creation
|
||||
* @returns {$.Deferred} switching end signal
|
||||
*/
|
||||
on_prev_view: function (created) {
|
||||
var current_view = this.views_history.pop();
|
||||
var previous_view = this.views_history[this.views_history.length - 1];
|
||||
this.on_mode_switch(previous_view, true);
|
||||
// APR special case: "If creation mode from list (and only from a list),
|
||||
// after saving, go to page view (don't come back in list)"
|
||||
if (created && current_view === 'form' && previous_view === 'list') {
|
||||
return this.on_mode_switch('page');
|
||||
}
|
||||
return this.on_mode_switch(previous_view, true);
|
||||
},
|
||||
/**
|
||||
* Sets up the current viewmanager's search view.
|
||||
|
||||
Reference in New Issue
Block a user