[FIX] gamification: set data in noupdate blocks to allow the user to customise it...
authorMartin Trigaux <mat@openerp.com>
Fri, 18 Apr 2014 12:08:46 +0000 (14:08 +0200)
committerMartin Trigaux <mat@openerp.com>
Fri, 18 Apr 2014 12:08:46 +0000 (14:08 +0200)
bzr revid: mat@openerp.com-20140418120846-h8yo4ljult88f1h3

addons/gamification/data/badge.xml
addons/gamification/data/cron.xml
addons/gamification/data/goal_base.xml
addons/gamification/models/challenge.py
addons/gamification_sale_crm/sale_crm_goals.xml

index 5a390be..4035c51 100644 (file)
             <field name="rule_max_number">2</field>
             <field name="image" type="base64" file="gamification/static/img/badge_idea-image.png"/>
         </record>
-    </data>
-
-
-    <data noupdate="0">
 
         <record id="email_template_badge_received" model="email.template">
             <field name="name">Received Badge</field>
index 8585771..105f7d2 100644 (file)
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <openerp>
-    <data>
+    <data noupdate="1">
         <record forcecreate="True" id="ir_cron_check_challenge"
             model="ir.cron">
             <field name="name">Run Goal Challenge Checker</field>
index c8c1856..1c18a5a 100644 (file)
             ]]></field>
         </record>
 
-    </data>
-
-    <data>
-
         <!-- goal definitions -->
         <record model="gamification.goal.definition" id="definition_base_timezone">
             <field name="name">Set your Timezone</field>
index 06d0c44..8ac7753 100644 (file)
@@ -377,6 +377,7 @@ class gamification_challenge(osv.Model):
         can be called after each change in the list of users or lines.
         :param list(int) ids: the list of challenge concerned"""
 
+        goal_obj = self.pool.get('gamification.goal')
         for challenge in self.browse(cr, uid, ids, context):
             (start_date, end_date) = start_end_date_for_period(challenge.period)
 
@@ -390,7 +391,6 @@ class gamification_challenge(osv.Model):
                 # FIXME: allow to restrict to a subset of users
                 for user in challenge.user_ids:
 
-                    goal_obj = self.pool.get('gamification.goal')
                     domain = [('line_id', '=', line.id), ('user_id', '=', user.id)]
                     if start_date:
                         domain.append(('start_date', '=', start_date))
index 4c1f8e4..6db77be 100644 (file)
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 <openerp>
-    <data>
+    <data noupdate="1">
 
         <!-- goal definitions -->
         <record model="gamification.goal.definition" id="definition_crm_tot_invoices">