[IMP] add manager plan to manager group

bzr revid: mat@openerp.com-20130313101258-1zuqwkapeef1pvty
This commit is contained in:
Martin Trigaux
2013-03-13 11:12:58 +01:00
parent 95c244d35a
commit e0b0bd2c14
2 changed files with 7 additions and 1 deletions
+1 -1
View File
@@ -289,7 +289,7 @@ class gamification_goal(osv.Model):
"""Overwrite the write method to update the last_update field to today
If the current value is changed and the report frequency is set to On
change, q report is generated"""
change, a report is generated"""
vals['last_update'] = fields.date.today()
for goal in self.browse(cr, uid, ids, context=context):
+6
View File
@@ -193,6 +193,12 @@ class gamification_goal_plan(osv.Model):
new_group = self.pool.get('res.groups').browse(cr, uid, vals['autojoin_group_id'], context=context)
if new_group:
self.plan_subscribe_users(cr, uid, ids, [user.id for user in new_group.users], context=context)
# add the selected manager to the goal_manager group
if 'manager_id' in vals:
group_ref = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'gamification', 'group_goal_manager')
self.pool.get('res.users').write(cr, uid, [vals['manager_id']], {'groups_id': [(4, group_ref[1])]}, context=context)
return write_res