From b9f2d689b04375a05d05b6a8f75aa22e12d4e618 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Wed, 13 Mar 2013 17:43:25 +0100 Subject: [PATCH] [FIX] gamification: don't check the date if no datefield bzr revid: mat@openerp.com-20130313164325-wfswwojyrnzygaul --- addons/gamification/badge_view.xml | 2 +- addons/gamification/goal.py | 5 +++-- addons/gamification/plan.py | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/addons/gamification/badge_view.xml b/addons/gamification/badge_view.xml index 5c8a2c4b559..fd745d1d68c 100644 --- a/addons/gamification/badge_view.xml +++ b/addons/gamification/badge_view.xml @@ -6,7 +6,7 @@ Badges gamification.badge - tree,form + tree,form,kanban

Click to create a badge. diff --git a/addons/gamification/goal.py b/addons/gamification/goal.py index 885524ca8d2..316d848a1dc 100644 --- a/addons/gamification/goal.py +++ b/addons/gamification/goal.py @@ -218,9 +218,9 @@ class gamification_goal(osv.Model): domain = safe_eval(goal.type_id.domain, {'user_id': goal.user_id.id}) - if goal.start_date: + if goal.start_date and field_date_name: domain.append((field_date_name, '>=', goal.start_date)) - if goal.end_date: + if goal.end_date and field_date_name: domain.append((field_date_name, '<=', goal.end_date)) if goal.type_id.computation_mode == 'sum': @@ -234,6 +234,7 @@ class gamification_goal(osv.Model): towrite = {'current': 0} else: # computation mode = count + print(uid, domain, type(obj)) res = obj.search(cr, uid, domain, context=context) towrite = {'current': len(res)} diff --git a/addons/gamification/plan.py b/addons/gamification/plan.py index 367250f1cd9..87f69a44288 100644 --- a/addons/gamification/plan.py +++ b/addons/gamification/plan.py @@ -47,7 +47,7 @@ def start_end_date_for_period(period): elif period == 'yearly': start_date = today.replace(month=1, day=1) end_date = today.replace(month=12, day=31) - else: # period == 'once': + else: # period == 'once': start_date = False # for manual goal, start each time end_date = False