[FIX] account_voucher: Wrong reconciliation of customer payments

Steps to reproduce :

1. Create a new customer
2. Create an invoice with an amount of 50.- for this new customer and validate it
3. Create a refund with an amount of 70.- for the same customer and validate it
4. Create a Customer Payment for this customer and validate it. The Invoice will be paid with 50.- of the refund. 20.- are still on residual in the refund.
5. Create a new invoice with an amount of 50.- for the same customer.
6. Create a new Customer Payment for the same Customer and validate it.

The Full Reconcile Boolean stays checked inspite of "Open Balance" of Refund amount is less than the Invoice amount.

After the fix:
Full Reconciliation Boolean doesn't get checked and Allocation amount on invoice journal item line should be same
as Open balance of the Refund Journal Item. So Invoice stays open with Balance amount.

opw:691577
This commit is contained in:
Goffin Simon 2016-10-27 12:51:44 +02:00
parent c340284a60
commit d406314638
1 changed files with 5 additions and 4 deletions

View File

@ -757,14 +757,15 @@ class account_voucher(osv.osv):
move_lines_found.append(line.id)
break
#otherwise we will split the voucher amount on each line (by most old first)
total_credit += line.credit or 0.0
total_debit += line.debit or 0.0
total_credit += line.credit and line.amount_residual or 0.0
total_debit += line.debit and line.amount_residual or 0.0
elif currency_id == line.currency_id.id:
if line.amount_residual_currency == price:
move_lines_found.append(line.id)
break
total_credit += line.credit and line.amount_currency or 0.0
total_debit += line.debit and line.amount_currency or 0.0
line_residual = currency_pool.compute(cr, uid, company_currency, currency_id, abs(line.amount_residual), context=context_multi_currency)
total_credit += line.credit and line_residual or 0.0
total_debit += line.debit and line_residual or 0.0
remaining_amount = price
#voucher line creation