[FIX] account: avoid ZeroDivisionError
bzr revid: chs@tinyerp.com-20091013143410-sz59hp38dvv1ufor
This commit is contained in:
@@ -115,7 +115,10 @@ class account_invoice(osv.osv):
|
||||
else:
|
||||
debit += lines.debit
|
||||
credit += lines.credit
|
||||
if inv.type in ('out_invoice','in_refund'):
|
||||
|
||||
if not inv.amount_total:
|
||||
result = 0.0
|
||||
elif inv.type in ('out_invoice','in_refund'):
|
||||
result = inv.amount_total * (1.0 - credit / (debit + inv.amount_total))
|
||||
else:
|
||||
result = inv.amount_total * (1.0 - debit / (credit + inv.amount_total))
|
||||
|
||||
Reference in New Issue
Block a user