[FIX] account: reconcile: no useless revalidation
Avoid revalidating the complete account moves that contain the lines being reconciled. The reconciliation does not change the validity of those moves anyway. This represents a very important speed up of reconciliation when moves with several hundred lines are involved.
This commit is contained in:
parent
deacba0ed6
commit
971ffa3db1
|
@ -1682,7 +1682,8 @@ class account_move_reconcile(osv.osv):
|
||||||
if not total:
|
if not total:
|
||||||
self.pool.get('account.move.line').write(cr, uid,
|
self.pool.get('account.move.line').write(cr, uid,
|
||||||
map(lambda x: x.id, rec.line_partial_ids),
|
map(lambda x: x.id, rec.line_partial_ids),
|
||||||
{'reconcile_id': rec.id }
|
{'reconcile_id': rec.id },
|
||||||
|
context=context
|
||||||
)
|
)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
|
@ -803,11 +803,14 @@ class account_move_line(osv.osv):
|
||||||
if self.pool.get('res.currency').is_zero(cr, uid, currency_id, total):
|
if self.pool.get('res.currency').is_zero(cr, uid, currency_id, total):
|
||||||
res = self.reconcile(cr, uid, merges+unmerge, context=context, writeoff_acc_id=writeoff_acc_id, writeoff_period_id=writeoff_period_id, writeoff_journal_id=writeoff_journal_id)
|
res = self.reconcile(cr, uid, merges+unmerge, context=context, writeoff_acc_id=writeoff_acc_id, writeoff_period_id=writeoff_period_id, writeoff_journal_id=writeoff_journal_id)
|
||||||
return res
|
return res
|
||||||
|
# marking the lines as reconciled does not change their validity, so there is no need
|
||||||
|
# to revalidate their moves completely.
|
||||||
|
reconcile_context = dict(context, novalidate=True)
|
||||||
r_id = move_rec_obj.create(cr, uid, {
|
r_id = move_rec_obj.create(cr, uid, {
|
||||||
'type': type,
|
'type': type,
|
||||||
'line_partial_ids': map(lambda x: (4,x,False), merges+unmerge)
|
'line_partial_ids': map(lambda x: (4,x,False), merges+unmerge)
|
||||||
}, context=context)
|
}, context=reconcile_context)
|
||||||
move_rec_obj.reconcile_partial_check(cr, uid, [r_id] + merges_rec, context=context)
|
move_rec_obj.reconcile_partial_check(cr, uid, [r_id] + merges_rec, context=reconcile_context)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def reconcile(self, cr, uid, ids, type='auto', writeoff_acc_id=False, writeoff_period_id=False, writeoff_journal_id=False, context=None):
|
def reconcile(self, cr, uid, ids, type='auto', writeoff_acc_id=False, writeoff_period_id=False, writeoff_journal_id=False, context=None):
|
||||||
|
@ -932,11 +935,14 @@ class account_move_line(osv.osv):
|
||||||
writeoff_line_ids = [writeoff_line_ids[1]]
|
writeoff_line_ids = [writeoff_line_ids[1]]
|
||||||
ids += writeoff_line_ids
|
ids += writeoff_line_ids
|
||||||
|
|
||||||
|
# marking the lines as reconciled does not change their validity, so there is no need
|
||||||
|
# to revalidate their moves completely.
|
||||||
|
reconcile_context = dict(context, novalidate=True)
|
||||||
r_id = move_rec_obj.create(cr, uid, {
|
r_id = move_rec_obj.create(cr, uid, {
|
||||||
'type': type,
|
'type': type,
|
||||||
'line_id': map(lambda x: (4, x, False), ids),
|
'line_id': map(lambda x: (4, x, False), ids),
|
||||||
'line_partial_ids': map(lambda x: (3, x, False), ids)
|
'line_partial_ids': map(lambda x: (3, x, False), ids)
|
||||||
})
|
}, context=reconcile_context)
|
||||||
wf_service = netsvc.LocalService("workflow")
|
wf_service = netsvc.LocalService("workflow")
|
||||||
# the id of the move.reconcile is written in the move.line (self) by the create method above
|
# the id of the move.reconcile is written in the move.line (self) by the create method above
|
||||||
# because of the way the line_id are defined: (4, x, False)
|
# because of the way the line_id are defined: (4, x, False)
|
||||||
|
|
Loading…
Reference in New Issue