[FIX] web: fix quick edit tests

Before this commit, quick edit tests could crash in an undetermined way.
It was due to the setTimeout for the quick edit event in FormController
which waits at least 1 tick even if timeout = 0 like in those tests.
Now, if this timeout is 0 then we bypass the setTimeout.
This commit is contained in:
Michael Mattiello (mcm)
2021-03-31 09:30:07 +00:00
parent 6c11a1c15b
commit 7ad8bb2c09
@@ -696,16 +696,21 @@ var FormController = BasicController.extend({
* @private
* @param {OdooEvent} ev
*/
_onQuickEdit: async function (ev) {
_onQuickEdit: function (ev) {
ev.stopPropagation();
clearTimeout(this.quickEditTimeout);
if (this.activeActions.edit && !window.getSelection().toString()) {
this.quickEditTimeout = setTimeout(async () => {
const quickEdit = async () => {
if (!this.isDestroyed()) {
await this._setEditMode();
this.renderer.quickEdit(ev.data);
}
}, this.multiClickTime);
};
if (this.multiClickTime > 0) {
this.quickEditTimeout = setTimeout(quickEdit, this.multiClickTime);
} else {
quickEdit();
}
}
},
/**