Reconcile optimization: avoid to do a partial reconcile if it was

already reconciled with the same lines

Before this optimization, the same partial reconciliation were created
at each run of the automatic reconcile.
This commit is contained in:
Guewen Baconnier
2014-07-18 15:59:19 +02:00
parent 9ddc895a81
commit c4a1f50e50

View File

@@ -71,6 +71,7 @@ class EasyReconcileBase(orm.AbstractModel):
'name',
'partner_id',
'account_id',
'reconcile_partial_id',
'move_id')
return ["account_move_line.%s" % col for col in aml_cols]
@@ -195,6 +196,19 @@ class EasyReconcileBase(orm.AbstractModel):
context=rec_ctx)
return True, True
elif allow_partial:
# Check if the group of move lines was already partially
# reconciled and if all the lines were the same, in such
# case, just skip the group and consider it as partially
# reconciled (no change).
existing_partial_id = lines[0]['reconcile_partial_id']
if existing_partial_id:
partial_line_ids = set(ml_obj.search(
cr, uid,
[('reconcile_partial_id', '=', existing_partial_id)],
context=context))
if set(line_ids) == partial_line_ids:
return True, False
ml_obj.reconcile_partial(
cr, uid,
line_ids,