[FIX] account: in bank statement reconciliation, show the invoice line from a partial reconciliation.
Since all the lines in a partial reconciliation share the same state and the same amount_residual, we need to keep only one 'result' line. It was the first line found that was kept ; now it's the line whose amount is greater than amount_residual, whiwh most likely is the significant one. Fixes #5129
This commit is contained in:
parent
f9d8493ee9
commit
69b6cf44bd
|
@ -647,7 +647,8 @@ class account_bank_statement_line(osv.osv):
|
|||
mv_line_pool = self.pool.get('account.move.line')
|
||||
domain = self._domain_move_lines_for_reconciliation(cr, uid, st_line, excluded_ids=excluded_ids, str=str, additional_domain=additional_domain, context=context)
|
||||
|
||||
# Get move lines ; in case of a partial reconciliation, only consider one line
|
||||
# Get move lines ; in case of a partial reconciliation, only keep one line (the first whose amount is greater than
|
||||
# the residual amount because it is presumably the invoice, which is the relevant item in this situation)
|
||||
filtered_lines = []
|
||||
reconcile_partial_ids = []
|
||||
actual_offset = offset
|
||||
|
@ -656,7 +657,9 @@ class account_bank_statement_line(osv.osv):
|
|||
lines = mv_line_pool.browse(cr, uid, line_ids, context=context)
|
||||
make_one_more_loop = False
|
||||
for line in lines:
|
||||
if line.reconcile_partial_id and line.reconcile_partial_id.id in reconcile_partial_ids:
|
||||
if line.reconcile_partial_id and \
|
||||
(line.reconcile_partial_id.id in reconcile_partial_ids or \
|
||||
abs(line.debit - line.credit) < abs(line.amount_residual)):
|
||||
#if we filtered a line because it is partially reconciled with an already selected line, we must do one more loop
|
||||
#in order to get the right number of items in the pager
|
||||
make_one_more_loop = True
|
||||
|
|
Loading…
Reference in New Issue