[FIX] gamification: do not set a start_date by default as the cron starts past challenges (making data challenge to start) and avoid useless write
bzr revid: mat@openerp.com-20140424110341-pnu79q44m7gzl8t0
This commit is contained in:
parent
ca63094542
commit
f73907587b
|
@ -199,7 +199,6 @@ class gamification_challenge(osv.Model):
|
|||
'visibility_mode': 'personal',
|
||||
'report_message_frequency': 'never',
|
||||
'last_report_date': fields.date.today,
|
||||
'start_date': fields.date.today,
|
||||
'manager_id': lambda s, cr, uid, c: uid,
|
||||
'category': 'hr',
|
||||
'reward_failure': False,
|
||||
|
@ -284,13 +283,15 @@ class gamification_challenge(osv.Model):
|
|||
planned_challenge_ids = self.search(cr, uid, [
|
||||
('state', '=', 'draft'),
|
||||
('start_date', '<=', fields.date.today())])
|
||||
self.write(cr, uid, planned_challenge_ids, {'state': 'inprogress'}, context=context)
|
||||
if planned_challenge_ids:
|
||||
self.write(cr, uid, planned_challenge_ids, {'state': 'inprogress'}, context=context)
|
||||
|
||||
# close planned challenges
|
||||
planned_challenge_ids = self.search(cr, uid, [
|
||||
('state', '=', 'inprogress'),
|
||||
('end_date', '>=', fields.date.today())])
|
||||
self.write(cr, uid, planned_challenge_ids, {'state': 'done'}, context=context)
|
||||
if planned_challenge_ids:
|
||||
self.write(cr, uid, planned_challenge_ids, {'state': 'done'}, context=context)
|
||||
|
||||
if not ids:
|
||||
ids = self.search(cr, uid, [('state', '=', 'inprogress')], context=context)
|
||||
|
|
Loading…
Reference in New Issue