mirror of
https://github.com/OCA/account-reconcile.git
synced 2025-01-20 12:27:39 +02:00
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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user