summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Trigaux <mat@odoo.com>2015-08-04 14:15:20 +0200
committerMartin Trigaux <mat@odoo.com>2015-10-07 16:29:00 +0200
commiteb18cad599a09da0fe20634d29fe5b1427b08102 (patch)
treedb079d42e16a1f87420aa5cd73fa368ce6642dd5
parent9b83dd5894fda3b8fb6a81bd20dd8ea8d6a5b1a4 (diff)
[FIX] gamification: avoid name clash with update
update is a method from the ORM with a different signature. Avoid name clash. Issue 646610
-rw-r--r--addons/gamification/models/challenge.py6
-rw-r--r--addons/gamification/models/goal.py4
-rw-r--r--addons/gamification/tests/test_challenge.py4
-rw-r--r--addons/gamification/views/goal.xml2
-rw-r--r--addons/gamification/wizard/update_goal.py2
5 files changed, 9 insertions, 9 deletions
diff --git a/addons/gamification/models/challenge.py b/addons/gamification/models/challenge.py
index 2634e34be22..d4d524ed17a 100644
--- a/addons/gamification/models/challenge.py
+++ b/addons/gamification/models/challenge.py
@@ -302,7 +302,7 @@ class gamification_challenge(osv.Model):
""", (tuple(ids), yesterday.strftime(DF)))
goal_ids = [res[0] for res in cr.fetchall()]
# update every running goal already generated linked to selected challenges
- goal_obj.update(cr, uid, goal_ids, context=context)
+ goal_obj.update_goal(cr, uid, goal_ids, context=context)
self._recompute_challenge_users(cr, uid, ids, context=context)
self._generate_goals_from_challenge(cr, uid, ids, context=context)
@@ -330,7 +330,7 @@ class gamification_challenge(osv.Model):
def quick_update(self, cr, uid, challenge_id, context=None):
"""Update all the goals of a specific challenge, no generation of new goals"""
goal_ids = self.pool.get('gamification.goal').search(cr, uid, [('challenge_id', '=', challenge_id)], context=context)
- self.pool.get('gamification.goal').update(cr, uid, goal_ids, context=context)
+ self.pool.get('gamification.goal').update_goal(cr, uid, goal_ids, context=context)
return True
def _get_challenger_users(self, cr, uid, domain, context=None):
@@ -456,7 +456,7 @@ class gamification_challenge(osv.Model):
goal_id = goal_obj.create(cr, uid, values, context=context)
to_update.append(goal_id)
- goal_obj.update(cr, uid, to_update, context=context)
+ goal_obj.update_goal(cr, uid, to_update, context=context)
return True
diff --git a/addons/gamification/models/goal.py b/addons/gamification/models/goal.py
index 5934c9a445b..57a81e21426 100644
--- a/addons/gamification/models/goal.py
+++ b/addons/gamification/models/goal.py
@@ -272,7 +272,7 @@ class gamification_goal(osv.Model):
return result
- def update(self, cr, uid, ids, context=None):
+ def update_goal(self, cr, uid, ids, context=None):
"""Update the goals to recomputes values and change of states
If a manual goal is not updated for enough time, the user will be
@@ -397,7 +397,7 @@ class gamification_goal(osv.Model):
This should only be used when creating goals manually (in draft state)"""
self.write(cr, uid, ids, {'state': 'inprogress'}, context=context)
- return self.update(cr, uid, ids, context=context)
+ return self.update_goal(cr, uid, ids, context=context)
def action_reach(self, cr, uid, ids, context=None):
"""Mark a goal as reached.
diff --git a/addons/gamification/tests/test_challenge.py b/addons/gamification/tests/test_challenge.py
index 2bd268f4226..2b1060b0031 100644
--- a/addons/gamification/tests/test_challenge.py
+++ b/addons/gamification/tests/test_challenge.py
@@ -59,8 +59,8 @@ class test_challenge(common.TransactionCase):
# demo user will set a timezone
self.user_obj.write(cr, uid, self.demo_user_id, {'tz': "Europe/Brussels"}, context=context)
goal_ids = self.goal_obj.search(cr, uid, [('user_id', '=', self.demo_user_id), ('definition_id', '=', self.definition_timezone_id)], context=context)
-
- self.goal_obj.update(cr, uid, goal_ids, context=context)
+
+ self.goal_obj.update_goal(cr, uid, goal_ids, context=context)
reached_goal_ids = self.goal_obj.search(cr, uid, [('id', 'in', goal_ids), ('state', '=', 'reached')], context=context)
self.assertEqual(set(goal_ids), set(reached_goal_ids), "Not every goal was reached after changing timezone")
diff --git a/addons/gamification/views/goal.xml b/addons/gamification/views/goal.xml
index 6c19e960cff..c29b8565687 100644
--- a/addons/gamification/views/goal.xml
+++ b/addons/gamification/views/goal.xml
@@ -78,7 +78,7 @@
<label for="current" />
<div>
<field name="current" class="oe_inline"/>
- <button string="refresh" type="object" name="update" class="oe_link" attrs="{'invisible':['|',('computation_mode', '=', 'manually'),('state', '=', 'draft')]}" />
+ <button string="refresh" type="object" name="update_goal" class="oe_link" attrs="{'invisible':['|',('computation_mode', '=', 'manually'),('state', '=', 'draft')]}" />
<div class="oe_grey" attrs="{'invisible':[('definition_id', '=', False)]}">
Reached when current value is <strong><field name="definition_condition" class="oe_inline"/></strong> than the target.
</div>
diff --git a/addons/gamification/wizard/update_goal.py b/addons/gamification/wizard/update_goal.py
index 77a10bda850..a648196b639 100644
--- a/addons/gamification/wizard/update_goal.py
+++ b/addons/gamification/wizard/update_goal.py
@@ -23,5 +23,5 @@ class goal_manual_wizard(osv.TransientModel):
'to_update': False,
}
goal_obj.write(cr, uid, [wiz.goal_id.id], towrite, context=context)
- goal_obj.update(cr, uid, [wiz.goal_id.id], context=context)
+ goal_obj.update_goal(cr, uid, [wiz.goal_id.id], context=context)
return {}