summaryrefslogtreecommitdiff
path: root/addons/gamification
diff options
context:
space:
mode:
authorMartin Trigaux <mat@openerp.com>2013-04-19 12:41:23 +0200
committerMartin Trigaux <mat@openerp.com>2013-04-19 12:41:23 +0200
commitcdecfc8e4a957ca7ad07dd68d362166d162a2f5e (patch)
tree19b3ac90114e00ffba59ea6ec9d82414939ff363 /addons/gamification
parentb7a6b6e1307eac912d88a786ba6cce1b4088e71b (diff)
[IMP] prevent drag&drop of goals
bzr revid: mat@openerp.com-20130419104123-4n6phm37216nj2u6
Diffstat (limited to 'addons/gamification')
-rw-r--r--addons/gamification/goal.py6
-rw-r--r--addons/gamification/plan_view.xml1
2 files changed, 6 insertions, 1 deletions
diff --git a/addons/gamification/goal.py b/addons/gamification/goal.py
index 234acd4a879..3c1109ac44f 100644
--- a/addons/gamification/goal.py
+++ b/addons/gamification/goal.py
@@ -339,7 +339,11 @@ class gamification_goal(osv.Model):
change, a report is generated"""
vals['last_update'] = fields.date.today()
+ result = super(gamification_goal, self).write(cr, uid, ids, vals, context=context)
for goal in self.browse(cr, uid, ids, context=context):
+ if goal.state != "draft" and ('type_id' in vals or 'user_id' in vals):
+ # avoid drag&drop in kanban view
+ raise osv.except_osv(_('Error!'), _('Can not modify a started goal'))
if 'current' in vals:
if 'just_created' in context:
@@ -349,7 +353,7 @@ class gamification_goal(osv.Model):
if goal.plan_id and goal.plan_id.report_message_frequency == 'onchange':
plan_obj = self.pool.get('gamification.goal.plan')
plan_obj.report_progress(cr, uid, goal.plan_id, users=[goal.user_id], context=context)
- return super(gamification_goal, self).write(cr, uid, ids, vals, context=context)
+ return result
def get_action(self, cr, uid, goal_id, context=None):
"""Get the ir.action related to update the goal
diff --git a/addons/gamification/plan_view.xml b/addons/gamification/plan_view.xml
index c41b0c37e85..e07740f02c6 100644
--- a/addons/gamification/plan_view.xml
+++ b/addons/gamification/plan_view.xml
@@ -182,6 +182,7 @@
</p>
</field>
</record>
+ <!-- Specify form view ID to avoid selecting view_challenge_wizard -->
<record id="goal_plan_list_action_view1" model="ir.actions.act_window.view">
<field eval="1" name="sequence"/>
<field name="view_mode">kanban</field>