diff --git a/addons/gamification/goal.py b/addons/gamification/goal.py index 3e7013ab0c2..885524ca8d2 100644 --- a/addons/gamification/goal.py +++ b/addons/gamification/goal.py @@ -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): diff --git a/addons/gamification/plan.py b/addons/gamification/plan.py index b771e5aed34..df8bcfb73a1 100644 --- a/addons/gamification/plan.py +++ b/addons/gamification/plan.py @@ -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