Skip to content

Commit 4344d50

Browse files
committed
[FIX] web: action_manager_tests: concurrency doAction: relax rpc assert
In general, the last actionManager's operation has priority over hanging previous ones. This means that the order of the RPC's done by the actionManager is deterministic. i.e. load_action, load_views However, when testing the concurrency, some RPC of an hanging actionManager operation (in this case a switchView to a form triggers a 'read'), may be fired anyway. Those are superfluous but irrelevant as long as the last displayed item is the one last asked by the user. This commit fixes the test 'execute a new action while switching to another controller' to not be bothered with an irrelevant controller's RPC messing with the orders of RPC. This is admittedly brutal, but justified with the current implementation of actionManager. closes odoo#57849 Related: odoo/enterprise#13280 Signed-off-by: Lucas Perais (lpe) <[email protected]>
1 parent e497fa0 commit 4344d50

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

addons/web/static/tests/chrome/action_manager_tests.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1571,17 +1571,28 @@ QUnit.module('ActionManager', {
15711571
QUnit.test('execute a new action while switching to another controller', async function (assert) {
15721572
assert.expect(15);
15731573

1574+
/*
1575+
* This test's bottom line is that a doAction always has priority
1576+
* over a switch controller (clicking on a record row to go to form view).
1577+
* In general, the last actionManager's operation has priority because we want
1578+
* to allow the user to make mistakes, or to rapidly reconsider her next action.
1579+
* Here we assert that the actionManager's RPC are in order, but a 'read' operation
1580+
* is expected, with the current implementation, to take place when switching to the form view.
1581+
* Ultimately the form view's 'read' is superfluous, but can happen at any point of the flow,
1582+
* except at the very end, which should always be the final action's list's 'search_read'.
1583+
*/
15741584
var def;
15751585
var actionManager = await createActionManager({
15761586
actions: this.actions,
15771587
archs: this.archs,
15781588
data: this.data,
15791589
mockRPC: function (route, args) {
15801590
var result = this._super.apply(this, arguments);
1581-
assert.step(args.method || route);
15821591
if (args.method === 'read') {
1592+
assert.ok(true, "A 'read' should have been done. Check test's comment though.");
15831593
return Promise.resolve(def).then(_.constant(result));
15841594
}
1595+
assert.step(args.method || route);
15851596
return result;
15861597
},
15871598
});
@@ -1612,7 +1623,6 @@ QUnit.module('ActionManager', {
16121623
'load_views', // action 3
16131624
'/web/dataset/search_read', // search read of list view of action 3
16141625
'/web/action/load', // action 4
1615-
'read', // read the opened record of action 3 (this request is blocked)
16161626
'load_views', // action 4
16171627
'/web/dataset/search_read', // search read action 4
16181628
]);

0 commit comments

Comments
 (0)