mirror of
https://github.com/OCA/account-reconcile.git
synced 2025-01-20 12:27:39 +02:00
Fix infinite loop in easy_reconcile
This commit is contained in:
@@ -37,6 +37,7 @@ class EasyReconcileSimple(AbstractModel):
|
||||
if self._key_field is None:
|
||||
raise ValueError("_key_field has to be defined")
|
||||
count = 0
|
||||
commit_count = 0
|
||||
res = []
|
||||
while (count < len(lines)):
|
||||
for i in xrange(count + 1, len(lines)):
|
||||
@@ -57,16 +58,17 @@ class EasyReconcileSimple(AbstractModel):
|
||||
cr, uid, rec, [credit_line, debit_line],
|
||||
allow_partial=False, context=context)
|
||||
if reconciled:
|
||||
commit_count += 1
|
||||
res += [credit_line['id'], debit_line['id']]
|
||||
del lines[i]
|
||||
count += 1
|
||||
if (context['commit_every'] and
|
||||
count % context['commit_every'] == 0):
|
||||
commit_count % context['commit_every'] == 0):
|
||||
cr.commit()
|
||||
_logger.info(
|
||||
"Commit the reconciliations after %d lines",
|
||||
count)
|
||||
break
|
||||
count += 1
|
||||
return res, [] # empty list for partial, only full rec in "simple" rec
|
||||
|
||||
def _simple_order(self, rec, *args, **kwargs):
|
||||
|
||||
Reference in New Issue
Block a user