From dceeb97c5f26d9c012c25c579eed7a58ab446f75 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Thu, 6 Jun 2013 10:39:28 +0200 Subject: [PATCH] [IMP] gamification: add tooltip and explain update method bzr revid: mat@openerp.com-20130606083928-k00b7ydioi3ed5ra --- addons/gamification/goal.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/addons/gamification/goal.py b/addons/gamification/goal.py index 561cd7a5807..a511b2d5bcc 100644 --- a/addons/gamification/goal.py +++ b/addons/gamification/goal.py @@ -72,7 +72,8 @@ class gamification_goal_type(osv.Model): ('python', 'Automatic: execute a specific Python code'), ], string="Computation Mode", - required=True), #TODO: add help tooltip + help="Defined how will be computed the goals. The result of the operation will be stored in the field 'Current'.", + required=True), 'display_mode': fields.selection([ ('progress', 'Progressive (using numerical values)'), ('checkbox', 'Checkbox (done or not-done)'), @@ -223,8 +224,8 @@ class gamification_goal(osv.Model): continue if goal.type_id.computation_mode == 'manually': + # no comoutation for manual goals, only check for reminders towrite = {'current': goal.current} - # check for remind to update if goal.remind_update_delay and goal.last_update: delta_max = timedelta(days=goal.remind_update_delay) last_update = datetime.strptime(goal.last_update, '%Y-%m-%d').date() @@ -237,6 +238,7 @@ class gamification_goal(osv.Model): self.message_post(cr, uid, goal.id, body=body_html, partner_ids=[goal.user_id.partner_id.id], context=context, subtype='mail.mt_comment') elif goal.type_id.computation_mode == 'python': + # execute the chosen method values = {'cr': cr, 'uid': goal.user_id.id, 'context': context, 'self': self.pool.get('gamification.goal.type')} result = safe_eval(goal.type_id.compute_code, values, {}) @@ -251,6 +253,7 @@ class gamification_goal(osv.Model): obj = self.pool.get(goal.type_id.model_id.model) field_date_name = goal.type_id.field_date_id.name + # eval the domain with user_id replaced by goal user domain = safe_eval(goal.type_id.domain, {'user_id': goal.user_id.id}) if goal.start_date and field_date_name: