From a8445aac371221f3e90382b83acb0765d4f116a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Thu, 10 Apr 2014 16:10:49 +0200 Subject: [PATCH] [FIX] gamification: avoid discarding False or 0 given as result for python computation. bzr revid: tde@openerp.com-20140410141049-luw63buvf0jsvkoh --- addons/gamification/models/goal.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/gamification/models/goal.py b/addons/gamification/models/goal.py index 925b05de5ab..5e58e8bacf4 100644 --- a/addons/gamification/models/goal.py +++ b/addons/gamification/models/goal.py @@ -251,14 +251,14 @@ class gamification_goal(osv.Model): 'cr': cr, 'context': dict(context), # copy context to prevent side-effects of eval 'uid': uid, - 'result': False, + # 'result': False, 'date': date, 'datetime': datetime, 'timedelta': timedelta, 'time': time } code = goal.definition_id.compute_code.strip() safe_eval(code, cxt, mode="exec", nocopy=True) # the result of the evaluated codeis put in the 'result' local variable, propagated to the context - result = cxt.get('result', False) - if result and type(result) in (float, int, long): + result = cxt.get('result') + if result is not None and type(result) in (float, int, long): if result != goal.current: towrite['current'] = result else: