From 9745c8c6c601ea3f05524b67d21057ecbba14ec6 Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Fri, 15 Mar 2013 14:01:47 +0100 Subject: [PATCH] [FIX] account: prevent the residual amount of invoices/credit notes to be negative bzr revid: qdp-launchpad@openerp.com-20130315130147-1n6g5z7nghmucibo --- addons/account/account_invoice.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/account/account_invoice.py b/addons/account/account_invoice.py index 17135ed1f76..b4705245268 100644 --- a/addons/account/account_invoice.py +++ b/addons/account/account_invoice.py @@ -99,6 +99,8 @@ class account_invoice(osv.osv): for m in invoice.move_id.line_id: if m.account_id.type in ('receivable','payable'): result[invoice.id] += m.amount_residual_currency + #prevent the residual amount on the invoice to be less than 0 + result[invoice.id] = max(result[invoice.id], 0.0) return result # Give Journal Items related to the payment reconciled to this invoice