From 246b57c997ee74ec126c232e4595a29d083784a3 Mon Sep 17 00:00:00 2001 From: "Ravi Gohil (OpenERP)" Date: Mon, 21 Apr 2014 16:53:39 +0530 Subject: [PATCH] [FIX] account_voucher: Fixed wrong writeoff(Payment Difference) calculation by recompute_voucher_lines(...). (Maintenance Case: 605632) bzr revid: rgo@tinyerp.com-20140421112339-36q7ifaplea40r56 --- addons/account_voucher/account_voucher.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index 63c8ac5..776bd35 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -792,6 +792,7 @@ class account_voucher(osv.osv): total_credit += line.credit and line.amount_currency or 0.0 total_debit += line.debit and line.amount_currency or 0.0 + remaining_amount = price #voucher line creation for line in account_move_lines: @@ -812,13 +813,13 @@ class account_voucher(osv.osv): 'move_line_id':line.id, 'account_id':line.account_id.id, 'amount_original': amount_original, - 'amount': (line.id in move_lines_found) and min(abs(price), amount_unreconciled) or 0.0, + 'amount': (line.id in move_lines_found) and min(abs(remaining_amount), amount_unreconciled) or 0.0, 'date_original':line.date, 'date_due':line.date_maturity, 'amount_unreconciled': amount_unreconciled, 'currency_id': line_currency_id, } - price -= rs['amount'] + remaining_amount -= rs['amount'] #in case a corresponding move_line hasn't been found, we now try to assign the voucher amount #on existing invoices: we split voucher amount by most old first, but only for lines in the same currency if not move_lines_found: -- 1.7.10.4