[FIX] account: multi-click in reconciliation
- Open the bank reconciliation widget - Throttle the connection - Click multiple times on the same move line in order to select it The line is added multiple times to the statement line. We mitigate the behavior thanks to a `debounce`. Fixes #33000 opw-1978551 closes odoo/odoo#33020 Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
@@ -271,6 +271,7 @@ var LineRenderer = Widget.extend(FieldManagerMixin, {
|
||||
'field_changed': '_onFieldChanged',
|
||||
}),
|
||||
_avoidFieldUpdate: {},
|
||||
MV_LINE_DEBOUNCE: 200,
|
||||
|
||||
/**
|
||||
* create partner_id field in editable mode
|
||||
@@ -283,6 +284,11 @@ var LineRenderer = Widget.extend(FieldManagerMixin, {
|
||||
|
||||
this.model = model;
|
||||
this._initialState = state;
|
||||
if (this.MV_LINE_DEBOUNCE) {
|
||||
this._onSelectMoveLine = _.debounce(this._onSelectMoveLine, this.MV_LINE_DEBOUNCE, true);
|
||||
} else {
|
||||
this._onSelectMoveLine = this._onSelectMoveLine;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -585,6 +585,7 @@ odoo.define('account.reconciliation_tests', function (require) {
|
||||
"use strict";
|
||||
|
||||
var ReconciliationClientAction = require('account.ReconciliationClientAction');
|
||||
var ReconciliationRenderer = require('account.ReconciliationRenderer');
|
||||
var demoData = require('account.reconciliation_tests.data');
|
||||
|
||||
var testUtils = require('web.test_utils');
|
||||
@@ -592,7 +593,13 @@ var testUtils = require('web.test_utils');
|
||||
QUnit.module('account', {
|
||||
beforeEach: function () {
|
||||
this.params = demoData.getParams();
|
||||
}
|
||||
testUtils.patch(ReconciliationRenderer.LineRenderer, {
|
||||
MV_LINE_DEBOUNCE: 0,
|
||||
});
|
||||
},
|
||||
afterEach: function () {
|
||||
testUtils.unpatch(ReconciliationRenderer.LineRenderer);
|
||||
},
|
||||
}, function () {
|
||||
QUnit.module('Reconciliation');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user