diff --git a/addons/gamification/goal.py b/addons/gamification/goal.py index 5660084fa77..95e55fe4ab5 100644 --- a/addons/gamification/goal.py +++ b/addons/gamification/goal.py @@ -223,7 +223,7 @@ class gamification_goal(osv.Model): else: # computation mode = count res = obj.search(cr, uid, domain, context=context) towrite = {'current': len(res)} - + print(domain, res) # check goal target reached if (goal.type_id.condition == 'plus' \ and towrite['current'] >= goal.target_goal) \ diff --git a/addons/gamification/plan.py b/addons/gamification/plan.py index 8c31dcd57c7..b731f7af67b 100644 --- a/addons/gamification/plan.py +++ b/addons/gamification/plan.py @@ -338,9 +338,6 @@ class gamification_goal_plan(osv.Model): template_env = TemplateHelper() for plan in self.browse(cr, uid, ids, context=context): - if not plan.report_message_group_id: - # no report group, skipping - continue if plan.visibility_mode == 'board': # generate a shared report @@ -372,15 +369,17 @@ class gamification_goal_plan(osv.Model): planlines_boards.append({'goal_type':planline.type_id.name, 'board_goals':sorted_board}) body_html = template_env.get_template('group_progress.mako').render({'object':plan, 'planlines_boards':planlines_boards}) + print(body_html) self.message_post(cr, uid, plan.id, body=body_html, partner_ids=[user.partner_id.id for user in plan.user_ids], context=context, subtype='mail.mt_comment') - self.pool.get('mail.group').message_post(cr, uid, plan.report_message_group_id.id, - body=body_html, - context=context, - subtype='mail.mt_comment') + if plan.report_message_group_id: + self.pool.get('mail.group').message_post(cr, uid, plan.report_message_group_id.id, + body=body_html, + context=context, + subtype='mail.mt_comment') else: # generate individual reports @@ -401,10 +400,11 @@ class gamification_goal_plan(osv.Model): partner_ids=[user.partner_id.id], context=context, subtype='mail.mt_comment') - self.pool.get('mail.group').message_post(cr, uid, plan.report_message_group_id.id, - body=body_html, - context=context, - subtype='mail.mt_comment') + if plan.report_message_group_id: + self.pool.get('mail.group').message_post(cr, uid, plan.report_message_group_id.id, + body=body_html, + context=context, + subtype='mail.mt_comment') return True diff --git a/addons/gamification/templates/group_progress.mako b/addons/gamification/templates/group_progress.mako index a815b711114..332711fd1e4 100644 --- a/addons/gamification/templates/group_progress.mako +++ b/addons/gamification/templates/group_progress.mako @@ -9,8 +9,8 @@
${object.report_header or ''}
- - % for planline in planlines_boards: +| Goal | @@ -26,6 +24,9 @@${goal.current} | ${goal.completeness} % |
|---|
${object.report_header or ''}
You have not updated your progress for the goal ${object.type_id.name} (currently reached at ${object.completeness}%) for at least ${object.remind_update_delay}. Do not forget to do it.