Fix zero division

bzr revid: ced-118351894b2962c8df3ad7e2ab13c2964746db1f
This commit is contained in:
ced 2007-09-20 08:48:30 +00:00
parent dcaabeabf8
commit cd4ec3058a
1 changed files with 3 additions and 1 deletions

View File

@ -286,8 +286,10 @@ class account_analytic_account(osv.osv):
for account in self.browse(cr, uid, ids):
if account.ca_invoiced == 0:
res[account.id]=0.0
else:
elif account.real_margin <> 0.0:
res[account.id] = (account.ca_invoiced / account.real_margin) * 100
else:
res[account.id] = 0.0
for id in ids:
res[id] = round(res.get(id, 0.0),2)
return res