[FIX] account: reconciliation send all time propositions as partial

It is necessary to distinguish between the selected lines and the lines
with partial reconciliation.
This commit is contained in:
Christophe Matthieu
2017-06-01 15:26:48 +02:00
parent 1561c5f660
commit a3874fce47
2 changed files with 17 additions and 2 deletions
@@ -488,7 +488,7 @@ var StatementModel = BasicModel.extend({
values.push({
"partner_id": line.st_line.partner_id,
"counterpart_aml_dicts": _.map(_.filter(props, function (prop) {
return !isNaN(prop.id) || prop.partial_reconcile;
return !isNaN(prop.id) && prop.partial_reconcile;
}), self._formatToProcessReconciliation.bind(self, line)),
"payment_aml_ids": _.pluck(_.filter(props, function (prop) {
return !isNaN(prop.id) && !prop.partial_reconcile;
@@ -557,7 +557,7 @@ QUnit.module('account', {
QUnit.test('Reconciliation basic data', function (assert) {
assert.expect(13);
assert.expect(14);
var clientAction = new ReconciliationClientAction.StatementAction(null, this.params.options);
testUtils.addMockEnvironment(clientAction, {
@@ -594,6 +594,21 @@ QUnit.module('account', {
clientAction.widgets[3].$('.accounting_view thead td:first').trigger('click');
assert.strictEqual(clientAction.widgets[3].$el.data('mode'), 'create', "should switch to 'create' mode instead 'match' mode when 'match' mode is empty");
// open the first line
widget.$('.accounting_view thead td:first').trigger('click');
// select propositions
widget.$('.match .cell_account_code:first').trigger('click');
widget.$('.match .cell_account_code:first').trigger('click');
testUtils.intercept(clientAction, 'call_service', function (event) {
assert.deepEqual(event.data.args[1].args,
[[5],[{partner_id: 8, counterpart_aml_dicts: [], payment_aml_ids: [109,112], new_aml_dicts: []}]],
"Should call process_reconciliations with ids");
});
// click on reconcile button
widget.$('button.o_reconcile:not(:hidden)').trigger('click');
clientAction.destroy();
});