[IMP] prevent drag&drop of goals

bzr revid: mat@openerp.com-20130419104123-4n6phm37216nj2u6
This commit is contained in:
Martin Trigaux 2013-04-19 12:41:23 +02:00
parent b7a6b6e130
commit cdecfc8e4a
2 changed files with 6 additions and 1 deletions

View File

@ -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

View File

@ -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>