[FIX] web: action manager fullscreen toggle

From a standard view with the main menu (what is called a target=current action)
open a target=fullscreen action
Then, go back to the first action, with the breadcrumbs for example

Before this commit, the original view was displayed fullscreen,
which impaired business navigation because the main menu was not there anymore

After this commit, the original view has the main menu

OPW 1906373

closes odoo/odoo#29096
This commit is contained in:
Lucas Perais (lpe)
2018-11-28 12:23:41 +00:00
parent 651a11588f
commit 15bcae2dc0
2 changed files with 76 additions and 3 deletions
@@ -360,9 +360,6 @@ var ActionManager = Widget.extend({
// update the internal state and the DOM
self._pushController(controller, options);
// toggle the fullscreen mode for actions in target='fullscreen'
self._toggleFullscreen();
// store the action into the sessionStorage so that it can be
// fully restored on F5
self.call('session_storage', 'setItem', 'current_action', action._originalAction);
@@ -751,6 +748,9 @@ var ActionManager = Widget.extend({
action: this.getCurrentAction(),
controller: controller,
});
// toggle the fullscreen mode for actions in target='fullscreen'
this._toggleFullscreen();
},
/**
* Pushes the given state, with additional information about the given
@@ -3409,6 +3409,79 @@ QUnit.module('ActionManager', {
actionManager.destroy();
});
QUnit.test('fullscreen on action change: back to a "current" action', function (assert) {
assert.expect(3);
this.actions[0].target = 'fullscreen';
this.archs['partner,false,form'] = '<form>' +
'<button name="1" type="action" class="oe_stat_button" />' +
'</form>';
var actionManager = createActionManager({
actions: this.actions,
archs: this.archs,
data: this.data,
intercepts: {
toggle_fullscreen: function (ev) {
var fullscreen = ev.data.fullscreen;
switch (toggleFullscreenCalls) {
case 0:
assert.strictEqual(fullscreen, false);
break;
case 1:
assert.strictEqual(fullscreen, true);
break;
case 2:
assert.strictEqual(fullscreen, false);
break;
}
},
},
});
var toggleFullscreenCalls = 0;
actionManager.doAction(6);
toggleFullscreenCalls = 1;
actionManager.$('button[name=1]').click();
toggleFullscreenCalls = 2;
$('.breadcrumb li a:first').click();
actionManager.destroy();
});
QUnit.test('fullscreen on action change: all "fullscreen" actions', function (assert) {
assert.expect(3);
this.actions[5].target = 'fullscreen';
this.archs['partner,false,form'] = '<form>' +
'<button name="1" type="action" class="oe_stat_button" />' +
'</form>';
var actionManager = createActionManager({
actions: this.actions,
archs: this.archs,
data: this.data,
intercepts: {
toggle_fullscreen: function (ev) {
var fullscreen = ev.data.fullscreen;
assert.strictEqual(fullscreen, true);
},
},
});
actionManager.doAction(6);
actionManager.$('button[name=1]').click();
$('.breadcrumb li a:first').click();
actionManager.destroy();
});
QUnit.module('"ir.actions.act_window_close" actions');
QUnit.test('close the currently opened dialog', function (assert) {