[FIX] web_kanban: double click double action
When multiple clicking fast (and with the server not too fast), we could end up with an error (eg. "Cannot read property 'controller' of null"). Something has been done previously to improve this when switching between views in:fc8a4b5e. This commit do something similar to limit multiple click on kanban records (doing it as in26f91c429). note: master equivalent of8f1cc2fa(which is for 10.0 up to saas-15) opw-705329 closes #16775
This commit is contained in:
@@ -39,6 +39,8 @@ var KanbanRecord = Widget.extend({
|
||||
this.subWidgets = {};
|
||||
|
||||
this._setState(state);
|
||||
// avoid quick multiple clicks
|
||||
this._onKanbanActionClicked = _.debounce(this._onKanbanActionClicked, 300, true);
|
||||
},
|
||||
start: function () {
|
||||
return this._super.apply(this, arguments).then(this._render.bind(this));
|
||||
|
||||
@@ -945,7 +945,7 @@ QUnit.module('Views', {
|
||||
});
|
||||
|
||||
QUnit.test('button executes action and reloads', function (assert) {
|
||||
assert.expect(5);
|
||||
assert.expect(6);
|
||||
|
||||
var kanban = createView({
|
||||
View: KanbanView,
|
||||
@@ -975,6 +975,9 @@ QUnit.module('Views', {
|
||||
$('button[data-name="a1"]').first().click();
|
||||
assert.strictEqual(count, 1, "should have triggered a execute action");
|
||||
|
||||
$('button[data-name="a1"]').first().click();
|
||||
assert.strictEqual(count, 1, "double-click on kanban actions should be debounced");
|
||||
|
||||
assert.verifySteps([
|
||||
'/web/dataset/search_read',
|
||||
'/web/dataset/call_kw/partner/read'
|
||||
|
||||
Reference in New Issue
Block a user