summaryrefslogtreecommitdiff
path: root/addons/gamification/models/res_users.py
diff options
context:
space:
mode:
authorDharmraj Jhala (OpenERP) <dizzy.zala@gmail.com>2014-02-25 11:02:04 +0530
committerDharmraj Jhala (OpenERP) <dizzy.zala@gmail.com>2014-02-25 11:02:04 +0530
commitc6917b9c074f3f2c19cac1dc3e05c8a3d2cadbed (patch)
tree6a17e259f27e029458207671d10fec50b5c425be /addons/gamification/models/res_users.py
parentb2688a37f84a505d8e334f8b0325b4747d440170 (diff)
parent9eb2db4465cefa5dc331123c1b0a4df035545015 (diff)
[MERGE] with trunk-survey2-rim addons branch
bzr revid: dizzy.zala@gmail.com-20140225053204-mra08nfvumkxyixa
Diffstat (limited to 'addons/gamification/models/res_users.py')
-rw-r--r--addons/gamification/models/res_users.py19
1 files changed, 12 insertions, 7 deletions
diff --git a/addons/gamification/models/res_users.py b/addons/gamification/models/res_users.py
index 408ddddf082..d25d725a4ac 100644
--- a/addons/gamification/models/res_users.py
+++ b/addons/gamification/models/res_users.py
@@ -42,6 +42,7 @@ class res_users_gamification_group(osv.Model):
challenge_ids = challenge_obj.search(cr, uid, [('autojoin_group_id', 'in', user_group_ids)], context=context)
if challenge_ids:
challenge_obj.write(cr, uid, challenge_ids, {'user_ids': [(4, user_id) for user_id in ids]}, context=context)
+ challenge_obj.generate_goals_from_challenge(cr, uid, challenge_ids, context=context)
return write_res
def create(self, cr, uid, vals, context=None):
@@ -56,6 +57,7 @@ class res_users_gamification_group(osv.Model):
challenge_ids = challenge_obj.search(cr, uid, [('autojoin_group_id', 'in', user_group_ids)], context=context)
if challenge_ids:
challenge_obj.write(cr, uid, challenge_ids, {'user_ids': [(4, write_res)]}, context=context)
+ challenge_obj.generate_goals_from_challenge(cr, uid, challenge_ids, context=context)
return write_res
# def get_goals_todo_info(self, cr, uid, context=None):
@@ -83,13 +85,15 @@ class res_users_gamification_group(osv.Model):
challenge_ids = challenge_obj.search(cr, uid, [('user_ids', 'in', uid), ('state', '=', 'inprogress')], context=context)
for challenge in challenge_obj.browse(cr, uid, challenge_ids, context=context):
# serialize goals info to be able to use it in javascript
- all_goals_info.append({
- 'id': challenge.id,
- 'name': challenge.name,
- 'visibility_mode': challenge.visibility_mode,
- 'currency': user.company_id.currency_id.id,
- 'lines': challenge_obj._get_serialized_challenge_lines(cr, uid, challenge, user_id, restrict_top=MAX_VISIBILITY_RANKING, context=context),
- })
+ lines = challenge_obj._get_serialized_challenge_lines(cr, uid, challenge, user_id, restrict_top=MAX_VISIBILITY_RANKING, context=context)
+ if lines:
+ all_goals_info.append({
+ 'id': challenge.id,
+ 'name': challenge.name,
+ 'visibility_mode': challenge.visibility_mode,
+ 'currency': user.company_id.currency_id.id,
+ 'lines': lines,
+ })
return all_goals_info
@@ -129,4 +133,5 @@ class res_groups_gamification_group(osv.Model):
challenge_ids = challenge_obj.search(cr, uid, [('autojoin_group_id', 'in', ids)], context=context)
if challenge_ids:
challenge_obj.write(cr, uid, challenge_ids, {'user_ids': [(4, user_id) for user_id in user_ids]}, context=context)
+ challenge_obj.generate_goals_from_challenge(cr, uid, challenge_ids, context=context)
return write_res