From a3c5009a7ac704dc99b9e93f3ba7ef8d28468b7e Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Fri, 29 Mar 2013 17:31:37 +0100 Subject: [PATCH] [ADD] autostart discover plan bzr revid: mat@openerp.com-20130329163137-l6e45b0qj89yfm5c --- addons/gamification/badge_view.xml | 5 +++++ addons/gamification/goal_base_data.xml | 4 ++-- addons/gamification/plan.py | 10 ++++++++-- addons/gamification/security/gamification_security.xml | 4 ++-- 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/addons/gamification/badge_view.xml b/addons/gamification/badge_view.xml index 9d36250a7ca..cdb2c4dcac0 100644 --- a/addons/gamification/badge_view.xml +++ b/addons/gamification/badge_view.xml @@ -147,6 +147,11 @@ jspW8F2wIbhtSRr0Vf4AD6Nod0TaN4kAAAAASUVORK5CYII=" alt="got-it" /> -->

Granted x ( pers.)

+
+ + + +
diff --git a/addons/gamification/goal_base_data.xml b/addons/gamification/goal_base_data.xml index 5c8158f5523..e2952df60be 100644 --- a/addons/gamification/goal_base_data.xml +++ b/addons/gamification/goal_base_data.xml @@ -11,8 +11,6 @@ [('id','=',user_id),('partner_id.tz', '!=', False)] base.action_res_users_my - inprogress - @@ -47,6 +45,8 @@ progressbar never + + inprogress diff --git a/addons/gamification/plan.py b/addons/gamification/plan.py index 53230c5cd87..76df8e7b3ad 100644 --- a/addons/gamification/plan.py +++ b/addons/gamification/plan.py @@ -25,6 +25,8 @@ from templates import TemplateHelper from datetime import date, datetime, timedelta import calendar +import logging +_logger = logging.getLogger(__name__) def start_end_date_for_period(period): @@ -208,7 +210,8 @@ class gamification_goal_plan(osv.Model): Start planned plans (in draft and with start_date = today) Create the goals for planlines not linked to goals (eg: modified the plan to add planlines) - Update every goal running""" + Update every goal running + """ if not context: context = {} # start planned plans @@ -280,7 +283,10 @@ class gamification_goal_plan(osv.Model): if plan.autojoin_group_id: self.plan_subscribe_users(cr, uid, ids, [user.id for user in plan.autojoin_group_id.users], context=context) - self.write(cr, uid, ids, {'state': 'inprogress'}, context=context) + if len(plan.user_ids) > 0: + self.write(cr, uid, plan.id, {'state': 'inprogress'}, context=context) + else: + _logger.warning("Can not start planned plan, no subscribed users") return self.generate_goals_from_plan(cr, uid, ids, context=context) def action_check(self, cr, uid, ids, context=None): diff --git a/addons/gamification/security/gamification_security.xml b/addons/gamification/security/gamification_security.xml index d3c30a97efc..8a60957558c 100644 --- a/addons/gamification/security/gamification_security.xml +++ b/addons/gamification/security/gamification_security.xml @@ -3,13 +3,13 @@ Goal - Helps you handle your lunch needs, if you are a manager you will be able to create new products, cashmoves and to confirm or cancel orders. + 17 User - + Manager