From 1795a342911991517e251ed94e8f3e620624558a Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Tue, 6 Nov 2012 13:37:59 +0100 Subject: [PATCH] [FIX] account_voucher: using pay invoice wizard on customer refund was creating wrong entries bzr revid: qdp-launchpad@openerp.com-20121106123759-rli58yp8lwyub59o --- addons/account_voucher/account_voucher.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index e1caf190316..8bd9a48b1f4 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -712,14 +712,14 @@ class account_voucher(osv.osv): 'move_line_id':line.id, 'account_id':line.account_id.id, 'amount_original': amount_original, - 'amount': (move_line_found == line.id) and min(price, amount_unreconciled) or 0.0, + 'amount': (move_line_found == line.id) and min(abs(price), amount_unreconciled) or 0.0, 'date_original':line.date, 'date_due':line.date_maturity, 'amount_unreconciled': amount_unreconciled, 'currency_id': line_currency_id, } - - #split voucher amount by most old first, but only for lines in the same currency + #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_line_found: if currency_id == line_currency_id: if line.credit: