[FIX] account: bank statement reconciliation speed improvement.

Removed assertion statement that was making a useless browse on account.move. This single patch is enough to divide by 4 the time of preprocessing a bank statement when opening its reconciliation widget.

That removed assertion is now a supposed prerequisite when calling the function and should be tested first (on batch of records).
This commit is contained in:
qdp-odoo
2016-07-06 09:55:28 +02:00
parent 489ea42859
commit 3f3c30887c
@@ -795,6 +795,7 @@ class AccountBankStatementLine(models.Model):
items, as well as a journal item for the bank statement line.
Finally, mark the statement line as reconciled by putting the matched moves ids in the column journal_entry_ids.
:param self: browse collection of records that are supposed to have no accounting entries already linked.
:param (list of dicts) counterpart_aml_dicts: move lines to create to reconcile with existing payables/receivables.
The expected keys are :
- 'name'
@@ -829,8 +830,6 @@ class AccountBankStatementLine(models.Model):
counterpart_moves = self.env['account.move']
# Check and prepare received data
if self.journal_entry_ids.ids:
raise UserError(_('The bank statement line was already reconciled.'))
if any(rec.statement_id for rec in payment_aml_rec):
raise UserError(_('A selected move line was already reconciled.'))
for aml_dict in counterpart_aml_dicts: