summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/chrome
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2017-07-14 15:51:59 +0200
committerChristophe Simonis <chs@odoo.com>2017-07-14 15:51:59 +0200
commitdb2f82d5f1a8c4fdbbd61a0aa7daef2def0ef06e (patch)
tree4dd6a0d816180b06963a245d01a817ebcdaf7868 /addons/web/static/src/js/chrome
parent55d72e1ab4a64f52e040911a8b4b4c8ce9443f65 (diff)
parent4ca3d9cadf9607c95880bb5222041bced7b13ec0 (diff)
[MERGE] forward port branch saas-16 up to 4ca3d9cadf9
Diffstat (limited to 'addons/web/static/src/js/chrome')
-rw-r--r--addons/web/static/src/js/chrome/action_manager.js18
-rw-r--r--addons/web/static/src/js/chrome/view_manager.js13
2 files changed, 14 insertions, 17 deletions
diff --git a/addons/web/static/src/js/chrome/action_manager.js b/addons/web/static/src/js/chrome/action_manager.js
index 280a90cec8d..5d4a44ba420 100644
--- a/addons/web/static/src/js/chrome/action_manager.js
+++ b/addons/web/static/src/js/chrome/action_manager.js
@@ -420,16 +420,20 @@ var ActionManager = Widget.extend({
return this.inner_widget;
},
history_back: function() {
- var nb_views = this.inner_action.get_nb_views();
- if (nb_views > 1) {
+ var nbViews = this.inner_action.get_nb_views();
+ if (nbViews > 1) {
// Stay on this action, but select the previous view
- return this.select_action(this.inner_action, nb_views - 2);
+ return this.select_action(this.inner_action, nbViews - 2);
}
- if (this.action_stack.length > 1) {
+ var nbActions = this.action_stack.length;
+ if (nbActions > 1) {
// Select the previous action
- var action = this.action_stack[this.action_stack.length - 2];
- nb_views = action.get_nb_views();
- return this.select_action(action, nb_views - 1);
+ var action = this.action_stack[nbActions - 2];
+ nbViews = action.get_nb_views();
+ return this.select_action(action, nbViews - 1);
+ }
+ else if (nbActions === 1 && nbViews === 1) {
+ return this.select_action(this.action_stack[0], 0);
}
return $.Deferred().reject();
},
diff --git a/addons/web/static/src/js/chrome/view_manager.js b/addons/web/static/src/js/chrome/view_manager.js
index 14ed4bdebc7..9b431d3e57a 100644
--- a/addons/web/static/src/js/chrome/view_manager.js
+++ b/addons/web/static/src/js/chrome/view_manager.js
@@ -561,7 +561,8 @@ var ViewManager = Widget.extend(ControlPanelMixin, {
var self = this;
var result_handler = on_closed || function () {};
var context = new Context(this.env.context, action_data.context || {});
- var record_id = res_ids && res_ids[0];
+ // OR NULL hereunder: pyeval waits specifically for a null value, different from undefined
+ var record_id = res_ids && res_ids[0] || null;
// response handler
var handler = function (action) {
@@ -651,18 +652,10 @@ var ViewManager = Widget.extend(ControlPanelMixin, {
* will call this very view manager to activate the previous view.
* @todo: directly switch to previous view
*
- * A special case is done in the case that there is no previous view. When
- * that happens, we simply rerender the current view.
- *
* @private
*/
_onSwitchToPreviousView: function () {
- if (this.view_stack.length === 1) {
- var currentView = this.view_stack[0].controller;
- currentView.update({}, {reload: false});
- } else {
- this.do_action('history_back');
- }
+ this.trigger_up('history_back');
}
});