+
+ Security rules to define who is allowed to manually grant badges. Not enforced for administrator.
+
diff --git a/addons/gamification/wizard/grant_badge.py b/addons/gamification/wizard/grant_badge.py
index 725512a55bb..e100b2dce29 100644
--- a/addons/gamification/wizard/grant_badge.py
+++ b/addons/gamification/wizard/grant_badge.py
@@ -43,16 +43,13 @@ class grant_badge_wizard(osv.TransientModel):
if uid == wiz.user_id.id:
raise osv.except_osv(_('Warning!'), _('You can not grant a badge to yourself'))
- #check if the badge granting is legitimate
- if badge_obj.check_granting(cr, uid, user_from_id=uid, badge_id=wiz.badge_id.id, context=context):
- #create the badge
- values = {
- 'user_id': wiz.user_id.id,
- 'badge_id': wiz.badge_id.id,
- 'comment': wiz.comment,
- }
- badge_user = badge_user_obj.create(cr, uid, values, context=context)
- #notify the user
- result = badge_obj.send_badge(cr, uid, wiz.badge_id.id, [badge_user], user_from=uid, context=context)
+ #create the badge
+ values = {
+ 'user_id': wiz.user_id.id,
+ 'badge_id': wiz.badge_id.id,
+ 'comment': wiz.comment,
+ }
+ badge_user = badge_user_obj.create(cr, uid, values, context=context)
+ result = badge_obj._send_badge(cr, uid, badge_user, user_from=uid, context=context)
return result
diff --git a/addons/hr_gamification/wizard/grant_badge.py b/addons/hr_gamification/wizard/grant_badge.py
index 95efe444114..539781216e1 100644
--- a/addons/hr_gamification/wizard/grant_badge.py
+++ b/addons/hr_gamification/wizard/grant_badge.py
@@ -48,18 +48,13 @@ class hr_grant_badge_wizard(osv.TransientModel):
if uid == wiz.user_id.id:
raise osv.except_osv(_('Warning!'), _('You can not send a badge to yourself'))
- if badge_obj.check_granting(cr, uid,
- user_from_id=uid,
- badge_id=wiz.badge_id.id,
- context=context):
+ values = {
+ 'user_id': wiz.user_id.id,
+ 'badge_id': wiz.badge_id.id,
+ 'employee_id': wiz.employee_id.id,
+ 'comment': wiz.comment,
+ }
- values = {
- 'user_id': wiz.user_id.id,
- 'badge_id': wiz.badge_id.id,
- 'employee_id': wiz.employee_id.id,
- 'comment': wiz.comment,
- }
- badge_user = badge_user_obj.create(cr, uid, values, context=context)
-
- result = badge_obj.send_badge(cr, uid, wiz.badge_id.id, [badge_user], user_from=uid, context=context)
+ badge_user = badge_user_obj.create(cr, uid, values, context=context)
+ result = badge_obj.send_badge(cr, uid, wiz.badge_id.id, [badge_user], user_from=uid, context=context)
return result
\ No newline at end of file