[FIX] account: prevent the residual amount of invoices/credit notes to be negative

bzr revid: qdp-launchpad@openerp.com-20130315130147-1n6g5z7nghmucibo
This commit is contained in:
Quentin (OpenERP) 2013-03-15 14:01:47 +01:00
parent 9485c49f4f
commit 9745c8c6c6
1 changed files with 2 additions and 0 deletions

View File

@ -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