summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Trigaux <mat@openerp.com>2013-03-13 17:43:25 +0100
committerMartin Trigaux <mat@openerp.com>2013-03-13 17:43:25 +0100
commitb9f2d689b04375a05d05b6a8f75aa22e12d4e618 (patch)
tree6f5b04fe6d9e7aab32c85e38e661d4eb847469f0
parentb58df69ed6e1b38bd3e2675585fe6928f0f647cf (diff)
[FIX] gamification: don't check the date if no datefield
bzr revid: mat@openerp.com-20130313164325-wfswwojyrnzygaul
-rw-r--r--addons/gamification/badge_view.xml2
-rw-r--r--addons/gamification/goal.py5
-rw-r--r--addons/gamification/plan.py2
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 @@
<record id="badge_list_action" model="ir.actions.act_window">
<field name="name">Badges</field>
<field name="res_model">gamification.badge</field>
- <field name="view_mode">tree,form</field>
+ <field name="view_mode">tree,form,kanban</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
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