[FIX] account: traceback in reconciliation widget

If a user reconcile an active line, when he active an other line, the
widget can't close the removed line because it no longer exists.

bug introduce by https://github.com/odoo/odoo/commit/1de418aa7afb986eeb2b98f12dee0c5661902737
This commit is contained in:
Christophe Matthieu
2017-08-24 16:20:29 +02:00
parent c0247e6a8d
commit ea60ec029d
2 changed files with 6 additions and 2 deletions
@@ -201,7 +201,10 @@ var StatementAction = Widget.extend(ControlPanelMixin, {
_.each(self.model.lines, function (line, _handle) {
if (line.mode !== 'inactive' && _handle !== handle) {
self.model.changeMode(_handle, 'inactive');
self._getWidget(_handle).update(line);
var widget = self._getWidget(_handle);
if (widget) {
widget.update(line);
}
}
});
}
@@ -1005,7 +1005,6 @@ QUnit.module('account', {
clientAction.destroy();
});
QUnit.test('Reconciliation pager', function (assert) {
assert.expect(6);
@@ -1219,9 +1218,11 @@ QUnit.module('account', {
assert.strictEqual(clientAction.$('.o_reconciliation_line').length, 10, "should display 10 lines");
assert.strictEqual(clientAction.$('.js_load_more:visible').length, 1, "should display the load more button");
clientAction.$('.accounting_view:has(.o_reconcile:visible) thead .cell_action').click();
clientAction.$('.o_reconcile:visible').click();
assert.strictEqual(clientAction.$('.o_reconcile:visible').length, 0, "should remove the reconciled line");
assert.strictEqual(clientAction.$('.o_reconciliation_line').length, 10, "should load one line to complete the 10");
clientAction.$('thead .cell_action:eq(1)').click();
clientAction.$('.js_load_more').click();
assert.strictEqual(clientAction.$('.o_reconciliation_line').length, 11, "should load the last record");
assert.strictEqual(clientAction.$('.js_load_more:visible').length, 0, "should hide the load more button");