From: user Date: Wed, 20 Mar 2013 10:30:48 +0000 (+0100) Subject: Correction division par 0 X-Git-Url: http://git.inspyration.org/?p=OpenERP%2Ftodolist.git;a=commitdiff_plain;h=09665ef5d206a13dc1ffbe18106a7b72d9230e8a Correction division par 0 --- diff --git a/todolist.py b/todolist.py index 14d9f16..44061c4 100644 --- a/todolist.py +++ b/todolist.py @@ -25,7 +25,7 @@ class Container(osv.Model): total += 1 if task.state == "done": done += 1 - result[container.id] = done/total + result[container.id] = total and done/total or 0. return result @@ -35,7 +35,7 @@ class Container(osv.Model): tasks = container.tasks total = len(tasks) done = len([t for t in tasks if t.state == "done"]) - result[container.id] = done/total*100. + result[container.id] = total and done/total or 0. return result