summaryrefslogtreecommitdiff
path: root/addons/web/static/tests
diff options
context:
space:
mode:
authorGéry Debongnie <ged@odoo.com>2018-04-19 17:04:30 +0200
committerGéry Debongnie <ged@odoo.com>2018-04-20 14:24:21 +0200
commit47cf31b539ade1e71450184300a338acb0cab9fa (patch)
treeb0be6b6c59ff6720af6b5d258eda7146c4c3ced4 /addons/web/static/tests
parentf2ba1cc843016c1f431a7335995df9bc86d500d4 (diff)
[FIX] web: prevent web client from blocking some view
In some situations, it could happen that the action manager had a rejected deferred representing the creation of a view, and was blocked from doing any other interaction with that view. For example, imagine that a read operation crashes for record 1 on the model res.partner. If the user is on the kanban view and click on record 1, there will be an error dialog informing him of the error. However, if the user clicks then on another record, nothing will happen because the action manager is blocked (only the form view in this case). With this commit, whenever the view creation process failed, we also remove the rejected deferred so the action manager will be allowed to try again.
Diffstat (limited to 'addons/web/static/tests')
-rw-r--r--addons/web/static/tests/chrome/action_manager_tests.js39
1 files changed, 39 insertions, 0 deletions
diff --git a/addons/web/static/tests/chrome/action_manager_tests.js b/addons/web/static/tests/chrome/action_manager_tests.js
index e6f97c20bdd..d987884ff83 100644
--- a/addons/web/static/tests/chrome/action_manager_tests.js
+++ b/addons/web/static/tests/chrome/action_manager_tests.js
@@ -2947,6 +2947,45 @@ QUnit.module('ActionManager', {
delete core.action_registry.map.slowAction;
});
+ QUnit.test('web client is not deadlocked when a view crashes', function (assert) {
+ assert.expect(3);
+
+ var readOnFirstRecordDef = $.Deferred();
+
+ var actionManager = createActionManager({
+ actions: this.actions,
+ archs: this.archs,
+ data: this.data,
+ mockRPC: function (route, args) {
+ if (args.method === 'read' && args.args[0][0] === 1) {
+ return readOnFirstRecordDef;
+ }
+ return this._super.apply(this, arguments);
+ }
+ });
+
+ actionManager.doAction(3);
+
+ // open first record in form view. this will crash and will not
+ // display a form view
+ actionManager.$('.o_list_view .o_data_row:first').click();
+
+ readOnFirstRecordDef.reject("not working as intended");
+
+ assert.strictEqual(actionManager.$('.o_list_view').length, 1,
+ "there should still be a list view in dom");
+
+ // open another record, the read will not crash
+ actionManager.$('.o_list_view .o_data_row:eq(2)').click();
+
+ assert.strictEqual(actionManager.$('.o_list_view').length, 0,
+ "there should not be a list view in dom");
+
+ assert.strictEqual(actionManager.$('.o_form_view').length, 1,
+ "there should be a form view in dom");
+
+ actionManager.destroy();
+ });
});
});