summaryrefslogtreecommitdiff
path: root/addons/gamification/models/challenge.py
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2014-10-01 19:18:14 +0200
committerChristophe Simonis <chs@odoo.com>2014-10-01 19:18:14 +0200
commit709c9868de7c4ac4985ed4e0055ae3e3e49742ad (patch)
treee90227a947bddf47b3043fcbe8b99529a22aa7dd /addons/gamification/models/challenge.py
parent85f26244a71a0b9a7faa283d6d24fdde6bae899a (diff)
parente8831932464814ed5f9e3a0af33f98891a466417 (diff)
[MERGE] forward port of branch 8.0 up to e883193
Diffstat (limited to 'addons/gamification/models/challenge.py')
-rw-r--r--addons/gamification/models/challenge.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/addons/gamification/models/challenge.py b/addons/gamification/models/challenge.py
index 2a1c6d5b0a5..4e128fc8f12 100644
--- a/addons/gamification/models/challenge.py
+++ b/addons/gamification/models/challenge.py
@@ -204,6 +204,7 @@ class gamification_challenge(osv.Model):
'category': 'hr',
'reward_failure': False,
'report_template_id': lambda s, *a, **k: s._get_report_template(*a, **k),
+ 'reward_realtime': True,
}
@@ -361,6 +362,9 @@ class gamification_challenge(osv.Model):
return True
+ def action_start(self, cr, uid, ids, context=None):
+ """Start a challenge"""
+ return self.write(cr, uid, ids, {'state': 'inprogress'}, context=context)
def action_check(self, cr, uid, ids, context=None):
"""Check a challenge
@@ -707,7 +711,7 @@ class gamification_challenge(osv.Model):
rewarded_users = []
challenge_ended = end_date == yesterday.strftime(DF) or force
- if challenge.reward_id and challenge_ended or challenge.reward_realtime:
+ if challenge.reward_id and (challenge_ended or challenge.reward_realtime):
# not using start_date as intemportal goals have a start date but no end_date
reached_goals = self.pool.get('gamification.goal').read_group(cr, uid, [
('challenge_id', '=', challenge.id),