[FIX] gamification: remove old calls to action_start
bzr revid: mat@openerp.com-20131224151543-oofn9wc2w3933gjy
This commit is contained in:
parent
58994713d8
commit
13bfaef3a3
|
@ -241,7 +241,7 @@ class gamification_challenge(osv.Model):
|
||||||
vals['user_ids'] += [(4, user.id) for user in new_group.users]
|
vals['user_ids'] += [(4, user.id) for user in new_group.users]
|
||||||
|
|
||||||
if vals.get('state') == 'inprogress':
|
if vals.get('state') == 'inprogress':
|
||||||
|
# starting a challenge
|
||||||
if not vals.get('autojoin_group_id'):
|
if not vals.get('autojoin_group_id'):
|
||||||
# starting challenge, add users in autojoin group
|
# starting challenge, add users in autojoin group
|
||||||
if not vals.get('user_ids'):
|
if not vals.get('user_ids'):
|
||||||
|
@ -284,13 +284,13 @@ class gamification_challenge(osv.Model):
|
||||||
planned_challenge_ids = self.search(cr, uid, [
|
planned_challenge_ids = self.search(cr, uid, [
|
||||||
('state', '=', 'draft'),
|
('state', '=', 'draft'),
|
||||||
('start_date', '<=', fields.date.today())])
|
('start_date', '<=', fields.date.today())])
|
||||||
self.action_start(cr, uid, planned_challenge_ids, context=context)
|
self.write(cr, uid, planned_challenge_ids, {'state': 'inprogress'}, context=context)
|
||||||
|
|
||||||
# close planned challenges
|
# close planned challenges
|
||||||
planned_challenge_ids = self.search(cr, uid, [
|
planned_challenge_ids = self.search(cr, uid, [
|
||||||
('state', '=', 'inprogress'),
|
('state', '=', 'inprogress'),
|
||||||
('end_date', '>=', fields.date.today())])
|
('end_date', '>=', fields.date.today())])
|
||||||
self.action_close(cr, uid, planned_challenge_ids, context=context)
|
self.write(cr, uid, planned_challenge_ids, {'state': 'done'}, context=context)
|
||||||
|
|
||||||
if not ids:
|
if not ids:
|
||||||
ids = self.search(cr, uid, [('state', '=', 'inprogress')], context=context)
|
ids = self.search(cr, uid, [('state', '=', 'inprogress')], context=context)
|
||||||
|
|
|
@ -63,7 +63,7 @@ class test_challenge(common.TransactionCase):
|
||||||
def test_10_reach_challenge(self):
|
def test_10_reach_challenge(self):
|
||||||
cr, uid, context = self.cr, self.uid, {}
|
cr, uid, context = self.cr, self.uid, {}
|
||||||
|
|
||||||
self.challenge_obj.action_start(cr, uid, [self.challenge_base_id], context=context)
|
self.challenge_obj.write(cr, uid, [self.challenge_base_id], {'state': 'inprogress'}, context=context)
|
||||||
challenge = self.challenge_obj.browse(cr, uid, self.challenge_base_id, context=context)
|
challenge = self.challenge_obj.browse(cr, uid, self.challenge_base_id, context=context)
|
||||||
challenge_user_ids = [user.id for user in challenge.user_ids]
|
challenge_user_ids = [user.id for user in challenge.user_ids]
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
from openerp.osv import fields, osv
|
from openerp.osv import fields, osv
|
||||||
from openerp import SUPERUSER_ID
|
|
||||||
|
|
||||||
|
|
||||||
class hr_gamification_badge_user(osv.Model):
|
class hr_gamification_badge_user(osv.Model):
|
||||||
|
|
Loading…
Reference in New Issue